diff --git a/packages/oxlint-config/src/test.js b/packages/oxlint-config/src/test.js index 80ef8c4..b7a6df6 100644 --- a/packages/oxlint-config/src/test.js +++ b/packages/oxlint-config/src/test.js @@ -6,12 +6,25 @@ import { testFiles } from './subconfigs/files.js' export default { overrides: [ + { + // Tests live in `*.spec.*` files beside their code, never in `*.test.*` ones + files: ['**/*'], + plugins: ['vitest'], + rules: { + 'vitest/consistent-test-filename': [ + 'error', + { + pattern: '.*\\.spec\\.[jt]sx?$' + } + ] + } + }, { files: testFiles, env: { vitest: true }, - plugins: ['typescript'], + plugins: ['typescript', 'vitest'], jsPlugins: ['@trigen/oxlint-config/plugin'], rules: { 'eslint/max-classes-per-file': 'off', @@ -34,7 +47,34 @@ export default { 'eslint/no-useless-assignment': 'off', 'eslint/no-empty-function': 'off', 'trigen/naming-convention': 'off', - 'trigen/func-style': 'off' + 'trigen/func-style': 'off', + 'vitest/consistent-test-it': [ + 'error', + { + fn: 'it', + withinDescribe: 'it' + } + ], + 'vitest/no-disabled-tests': 'error', + 'vitest/no-focused-tests': 'error', + 'vitest/no-identical-title': 'error', + 'vitest/no-standalone-expect': 'error', + 'vitest/prefer-importing-vitest-globals': 'error', + // The unit's address is a chain of describes, each with its own segment + 'vitest/require-top-level-describe': 'error', + 'vitest/valid-describe-callback': 'error', + 'vitest/valid-expect': 'error', + 'vitest/valid-title': [ + 'error', + { + mustMatch: { + it: '^should ' + }, + mustNotMatch: { + describe: '/' + } + } + ] // Unsupported by Oxlint // 'eslint/camelcase': 'off',