diff --git a/src/rules/__tests__/require-to-throw-message.test.ts b/src/rules/__tests__/require-to-throw-message.test.ts index 05bca3b93..74ef4fd78 100644 --- a/src/rules/__tests__/require-to-throw-message.test.ts +++ b/src/rules/__tests__/require-to-throw-message.test.ts @@ -67,8 +67,8 @@ ruleTester.run('require-to-throw-message', rule, { code: "expect(() => { throw new Error('a'); }).toThrow();", errors: [ { - messageId: 'requireRethrow', - data: { propertyName: 'toThrow' }, + messageId: 'addErrorMessage', + data: { matcherName: 'toThrow' }, column: 41, line: 1, }, @@ -79,8 +79,8 @@ ruleTester.run('require-to-throw-message', rule, { code: "expect(() => { throw new Error('a'); }).toThrowError();", errors: [ { - messageId: 'requireRethrow', - data: { propertyName: 'toThrowError' }, + messageId: 'addErrorMessage', + data: { matcherName: 'toThrowError' }, column: 41, line: 1, }, @@ -96,14 +96,14 @@ ruleTester.run('require-to-throw-message', rule, { })`, errors: [ { - messageId: 'requireRethrow', - data: { propertyName: 'toThrow' }, + messageId: 'addErrorMessage', + data: { matcherName: 'toThrow' }, column: 49, line: 3, }, { - messageId: 'requireRethrow', - data: { propertyName: 'toThrowError' }, + messageId: 'addErrorMessage', + data: { matcherName: 'toThrowError' }, column: 49, line: 4, }, @@ -121,8 +121,8 @@ ruleTester.run('require-tothrow-message', deprecatedRule, { code: "expect(() => { throw new Error('a'); }).toThrow();", errors: [ { - messageId: 'requireRethrow', - data: { propertyName: 'toThrow' }, + messageId: 'addErrorMessage', + data: { matcherName: 'toThrow' }, column: 41, line: 1, }, diff --git a/src/rules/require-to-throw-message.ts b/src/rules/require-to-throw-message.ts index 13282e4fc..ef4201e85 100644 --- a/src/rules/require-to-throw-message.ts +++ b/src/rules/require-to-throw-message.ts @@ -14,7 +14,7 @@ export default createRule({ recommended: false, }, messages: { - requireRethrow: 'Add an error message to {{ propertyName }}()', + addErrorMessage: 'Add an error message to {{ propertyName }}()', }, type: 'suggestion', schema: [], @@ -39,8 +39,8 @@ export default createRule({ ) { // Look for `toThrow` calls with no arguments. context.report({ - messageId: 'requireRethrow', // todo: rename to 'addErrorMessage' - data: { propertyName: matcher.name }, // todo: rename to 'matcherName' + messageId: 'addErrorMessage', + data: { matcherName: matcher.name }, node: matcher.node.property, }); }