From 84121eee018cc8cc32e6c7a267fc27efd3a4a0a0 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Sat, 30 Sep 2023 10:24:18 +1300 Subject: [PATCH] fix: make rule message punctuation consistent (#1444) --- src/rules/max-expects.ts | 2 +- src/rules/max-nested-describe.ts | 2 +- src/rules/no-export.ts | 2 +- src/rules/no-focused-tests.ts | 4 ++-- src/rules/no-identical-title.ts | 4 ++-- src/rules/no-if.ts | 2 +- src/rules/no-mocks-import.ts | 2 +- src/rules/no-standalone-expect.ts | 2 +- src/rules/no-test-return-statement.ts | 2 +- src/rules/prefer-expect-resolves.ts | 2 +- src/rules/prefer-spy-on.ts | 2 +- src/rules/valid-expect.ts | 14 +++++++------- src/rules/valid-title.ts | 2 +- 13 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/rules/max-expects.ts b/src/rules/max-expects.ts index 308e58977..3cc20e105 100644 --- a/src/rules/max-expects.ts +++ b/src/rules/max-expects.ts @@ -16,7 +16,7 @@ export default createRule({ }, messages: { exceededMaxAssertion: - 'Too many assertion calls ({{ count }}). Maximum allowed is {{ max }}.', + 'Too many assertion calls ({{ count }}) - maximum allowed is {{ max }}', }, type: 'suggestion', schema: [ diff --git a/src/rules/max-nested-describe.ts b/src/rules/max-nested-describe.ts index 63a94c106..b807a4591 100644 --- a/src/rules/max-nested-describe.ts +++ b/src/rules/max-nested-describe.ts @@ -11,7 +11,7 @@ export default createRule({ }, messages: { exceededMaxDepth: - 'Too many nested describe calls ({{ depth }}). Maximum allowed is {{ max }}.', + 'Too many nested describe calls ({{ depth }}) - maximum allowed is {{ max }}', }, type: 'suggestion', schema: [ diff --git a/src/rules/no-export.ts b/src/rules/no-export.ts index 2ec3d8ecd..bd94acfbd 100644 --- a/src/rules/no-export.ts +++ b/src/rules/no-export.ts @@ -10,7 +10,7 @@ export default createRule({ recommended: 'error', }, messages: { - unexpectedExport: `Do not export from a test file.`, + unexpectedExport: `Do not export from a test file`, }, type: 'suggestion', schema: [], diff --git a/src/rules/no-focused-tests.ts b/src/rules/no-focused-tests.ts index 43baf2986..0f740d94c 100644 --- a/src/rules/no-focused-tests.ts +++ b/src/rules/no-focused-tests.ts @@ -10,8 +10,8 @@ export default createRule({ recommended: 'error', }, messages: { - focusedTest: 'Unexpected focused test.', - suggestRemoveFocus: 'Remove focus from test.', + focusedTest: 'Unexpected focused test', + suggestRemoveFocus: 'Remove focus from test', }, schema: [], type: 'suggestion', diff --git a/src/rules/no-identical-title.ts b/src/rules/no-identical-title.ts index 11cefaaf2..b8d6f7227 100644 --- a/src/rules/no-identical-title.ts +++ b/src/rules/no-identical-title.ts @@ -27,9 +27,9 @@ export default createRule({ }, messages: { multipleTestTitle: - 'Test title is used multiple times in the same describe block.', + 'Test title is used multiple times in the same describe block', multipleDescribeTitle: - 'Describe block title is used multiple times in the same describe block.', + 'Describe block title is used multiple times in the same describe block', }, schema: [], type: 'suggestion', diff --git a/src/rules/no-if.ts b/src/rules/no-if.ts index 19255b007..e42f9a97d 100644 --- a/src/rules/no-if.ts +++ b/src/rules/no-if.ts @@ -43,7 +43,7 @@ export default createRule({ recommended: false, }, messages: { - conditionalInTest: 'Test should not contain {{ condition }} statements.', + conditionalInTest: 'Test should not contain {{ condition }} statements', }, deprecated: true, replacedBy: ['no-conditional-in-test'], diff --git a/src/rules/no-mocks-import.ts b/src/rules/no-mocks-import.ts index 784aeee57..5fac9172e 100644 --- a/src/rules/no-mocks-import.ts +++ b/src/rules/no-mocks-import.ts @@ -22,7 +22,7 @@ export default createRule({ recommended: 'error', }, messages: { - noManualImport: `Mocks should not be manually imported from a ${mocksDirName} directory. Instead use \`jest.mock\` and import from the original module path.`, + noManualImport: `Mocks should not be manually imported from a ${mocksDirName} directory. Instead use \`jest.mock\` and import from the original module path`, }, schema: [], }, diff --git a/src/rules/no-standalone-expect.ts b/src/rules/no-standalone-expect.ts index 2c9df0af1..5afcc977c 100644 --- a/src/rules/no-standalone-expect.ts +++ b/src/rules/no-standalone-expect.ts @@ -65,7 +65,7 @@ export default createRule< recommended: 'error', }, messages: { - unexpectedExpect: 'Expect must be inside of a test block.', + unexpectedExpect: 'Expect must be inside of a test block', }, type: 'suggestion', schema: [ diff --git a/src/rules/no-test-return-statement.ts b/src/rules/no-test-return-statement.ts index 9e179ee05..1efe214f9 100644 --- a/src/rules/no-test-return-statement.ts +++ b/src/rules/no-test-return-statement.ts @@ -29,7 +29,7 @@ export default createRule({ recommended: false, }, messages: { - noReturnValue: 'Jest tests should not return a value.', + noReturnValue: 'Jest tests should not return a value', }, schema: [], type: 'suggestion', diff --git a/src/rules/prefer-expect-resolves.ts b/src/rules/prefer-expect-resolves.ts index 191b9aa44..cc9b09605 100644 --- a/src/rules/prefer-expect-resolves.ts +++ b/src/rules/prefer-expect-resolves.ts @@ -12,7 +12,7 @@ export default createRule({ }, fixable: 'code', messages: { - expectResolves: 'Use `await expect(...).resolves instead.', + expectResolves: 'Use `await expect(...).resolves instead', }, schema: [], type: 'suggestion', diff --git a/src/rules/prefer-spy-on.ts b/src/rules/prefer-spy-on.ts index 545938edd..36ca2a350 100644 --- a/src/rules/prefer-spy-on.ts +++ b/src/rules/prefer-spy-on.ts @@ -73,7 +73,7 @@ export default createRule({ recommended: false, }, messages: { - useJestSpyOn: 'Use jest.spyOn() instead.', + useJestSpyOn: 'Use jest.spyOn() instead', }, fixable: 'code', schema: [], diff --git a/src/rules/valid-expect.ts b/src/rules/valid-expect.ts index 60bd0cdbe..93b3ef20f 100644 --- a/src/rules/valid-expect.ts +++ b/src/rules/valid-expect.ts @@ -120,14 +120,14 @@ export default createRule<[Options], MessageIds>({ recommended: 'error', }, messages: { - tooManyArgs: 'Expect takes at most {{ amount }} argument{{ s }}.', - notEnoughArgs: 'Expect requires at least {{ amount }} argument{{ s }}.', - modifierUnknown: 'Expect has an unknown modifier.', - matcherNotFound: 'Expect must have a corresponding matcher call.', - matcherNotCalled: 'Matchers must be called to assert.', - asyncMustBeAwaited: 'Async assertions must be awaited{{ orReturned }}.', + tooManyArgs: 'Expect takes at most {{ amount }} argument{{ s }}', + notEnoughArgs: 'Expect requires at least {{ amount }} argument{{ s }}', + modifierUnknown: 'Expect has an unknown modifier', + matcherNotFound: 'Expect must have a corresponding matcher call', + matcherNotCalled: 'Matchers must be called to assert', + asyncMustBeAwaited: 'Async assertions must be awaited{{ orReturned }}', promisesWithAsyncAssertionsMustBeAwaited: - 'Promises which return async assertions must be awaited{{ orReturned }}.', + 'Promises which return async assertions must be awaited{{ orReturned }}', }, type: 'suggestion', schema: [ diff --git a/src/rules/valid-title.ts b/src/rules/valid-title.ts index 302a8a226..9039a5cc5 100644 --- a/src/rules/valid-title.ts +++ b/src/rules/valid-title.ts @@ -122,7 +122,7 @@ export default createRule<[Options], MessageIds>({ emptyTitle: '{{ jestFunctionName }} should not have an empty title', duplicatePrefix: 'should not have duplicate prefix', accidentalSpace: 'should not have leading or trailing spaces', - disallowedWord: '"{{ word }}" is not allowed in test titles.', + disallowedWord: '"{{ word }}" is not allowed in test titles', mustNotMatch: '{{ jestFunctionName }} should not match {{ pattern }}', mustMatch: '{{ jestFunctionName }} should match {{ pattern }}', mustNotMatchCustom: '{{ message }}',