Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make rule message punctuation more consistent and address some typos #628

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rules/consistent-test-filename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default createEslintRule<
description: 'require .spec test file pattern'
},
messages: {
consistentTestFilename: 'use test file name pattern {{pattern}}'
consistentTestFilename: 'Use test file name pattern {{ pattern }}'
},
schema: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/rules/max-expects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
description: 'enforce a maximum number of expect per test'
},
messages: {
maxExpect: 'Too many assertion calls ({{count}}). Maximum is {{max}}.'
maxExpect: 'Too many assertion calls ({{ count }}) - maximum allowed is {{ max }}'
},
type: 'suggestion',
schema: [
Expand Down
2 changes: 1 addition & 1 deletion src/rules/max-nested-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default createEslintRule<Options, MESSAGE_ID>({
],
messages: {
maxNestedDescribe:
'Nested describe block should be less than set max value.'
'Nested describe block should be less than set max value'
}
},
defaultOptions: [
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-commented-out-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default createEslintRule<Options, MESSAGE_IDS>({
recommended: false
},
messages: {
noCommentedOutTests: 'Remove commented out tests. You may want to use `skip` or `only` instead.'
noCommentedOutTests: 'Remove commented out tests - you may want to use `skip` or `only` instead'
},
schema: [],
type: 'suggestion'
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-conditional-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default createEslintRule<[], MESSAGE_ID>({
},
schema: [],
messages: {
noConditionalTests: 'Avoid using if conditions in a test.'
noConditionalTests: 'Avoid using if conditions in a test'
}
},
defaultOptions: [],
Expand Down
4 changes: 2 additions & 2 deletions src/rules/no-disabled-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ export default createEslintRule<Options, MESSAGE_ID>({
pending: 'Call to pending()',
pendingSuite: 'Call to pending() within test suite',
pendingTest: 'Call to pending() within test',
disabledSuite: 'Disabled test suite. If you want to skip a test suite temporarily, use .todo() instead.',
disabledTest: 'Disabled test. If you want to skip a test temporarily, use .todo() instead.'
disabledSuite: 'Disabled test suite - if you want to skip a test suite temporarily, use .todo() instead',
disabledTest: 'Disabled test - if you want to skip a test temporarily, use .todo() instead'
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-duplicate-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default createEslintRule<Options, MESSAGE_IDS>({
requiresTypeChecking: false
},
messages: {
noDuplicateHooks: 'Duplicate {{hook}} in describe block.'
noDuplicateHooks: 'Duplicate {{ hook }} in describe block'
},
schema: [],
type: 'suggestion'
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-focused-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default createEslintRule<Options, MessageIds>({
}
],
messages: {
noFocusedTests: 'Focused tests are not allowed.'
noFocusedTests: 'Focused tests are not allowed'
}
},
defaultOptions: [{ fixable: true }],
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-mocks-import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default createEslintRule<Options, MESSAGE_IDS>({
recommended: false
},
messages: {
noMocksImport: `Mocks should not be manually imported from a ${mocksDirName} directory. Instead use \`vi.mock\` and import from the original module path.`
noMocksImport: `Mocks should not be manually imported from a ${mocksDirName} directory. Instead use \`vi.mock\` and import from the original module path`
},
schema: []
},
Expand Down
2 changes: 1 addition & 1 deletion src/rules/no-test-prefixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default createEslintRule<Options, MESSAGE_IDS>({
},
type: 'suggestion',
messages: {
usePreferredName: 'Use "{{preferredNodeName}}" instead'
usePreferredName: 'Use "{{ preferredNodeName }}" instead'
},
fixable: 'code',
schema: []
Expand Down
2 changes: 1 addition & 1 deletion src/rules/prefer-to-be-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default createEslintRule<Options, MESSAGE_IDS>({
},
fixable: 'code',
messages: {
preferToBeObject: 'Prefer toBeObject() to test if a value is an object.'
preferToBeObject: 'Prefer toBeObject() to test if a value is an object'
},
schema: []
},
Expand Down
4 changes: 2 additions & 2 deletions src/rules/require-top-level-describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default createEslintRule<Options, MESSAGE_IDS>({
messages: {
tooManyDescribes:
'There should not be more than {{ max }} describe{{ s }} at the top level',
unexpectedTestCase: 'All test cases must be wrapped in a describe block.',
unexpectedHook: 'All hooks must be wrapped in a describe block.'
unexpectedTestCase: 'All test cases must be wrapped in a describe block',
unexpectedHook: 'All hooks must be wrapped in a describe block'
},
type: 'suggestion',
schema: [
Expand Down
14 changes: 7 additions & 7 deletions src/rules/valid-expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ export default createEslintRule<[
recommended: false
},
messages: {
tooManyArgs: 'Expect takes most {{ amount}} argument{{s}}',
notEnoughArgs: 'Expect requires atleast {{ amount }} argument{{s}}',
modifierUnknown: 'Expect has 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',
fixable: 'code',
Expand Down
12 changes: 6 additions & 6 deletions src/rules/valid-title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ export default createEslintRule<Options, MESSAGE_IDS>({
},
messages: {
titleMustBeString: 'Test title must be a string, a function or class name',
emptyTitle: '{{functionName}} should not have an empty title',
emptyTitle: '{{ functionName }} 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 title',
mustNotMatch: '{{functionName}} should not match {{pattern}}',
mustMatch: '{{functionName}} should match {{pattern}}',
mustNotMatchCustom: '{{message}}',
mustMatchCustom: '{{message}}'
disallowedWord: '"{{ word }}" is not allowed in test title',
mustNotMatch: '{{ functionName }} should not match {{ pattern }}',
mustMatch: '{{ functionName }} should match {{ pattern }}',
mustNotMatchCustom: '{{ message }}',
mustMatchCustom: '{{ message }}'
},
type: 'suggestion',
schema: [
Expand Down