diff --git a/eslint.config.mjs b/eslint.config.mjs index d95766112604..a923dbeae9ac 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -29,9 +29,11 @@ const restrictNamedDeclarations = { selector: 'ExportNamedDeclaration[declaration=null][source=null]', }; -const vitestFiles = [ - 'packages/eslint-plugin-internal/tests/**/*.test.{ts,tsx,cts,mts}', -]; +const vitestPackages = ['eslint-plugin-internal']; + +const vitestFiles = vitestPackages.map( + name => `packages/${name}/tests/**/*.test.{ts,tsx,cts,mts}`, +); export default tseslint.config( // register all of the plugins up-front @@ -392,7 +394,6 @@ export default tseslint.config( 'packages/integration-tests/tools/integration-test-base.ts', 'packages/integration-tests/tools/pack-packages.ts', ], - ignores: vitestFiles, rules: { '@typescript-eslint/no-empty-function': [ 'error', @@ -403,6 +404,19 @@ export default tseslint.config( '@typescript-eslint/no-unsafe-call': 'off', '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/no-unsafe-return': 'off', + }, + }, + // jest-specific config + { + files: [ + 'packages/*/tests/**/*.test.{ts,tsx,cts,mts}', + 'packages/*/tests/**/test.{ts,tsx,cts,mts}', + 'packages/parser/tests/**/*.{ts,tsx,cts,mts}', + 'packages/integration-tests/tools/integration-test-base.ts', + 'packages/integration-tests/tools/pack-packages.ts', + ], + ignores: vitestFiles, + rules: { 'jest/no-alias-methods': 'error', 'jest/no-deprecated-functions': 'error', 'jest/no-disabled-tests': 'error', @@ -419,19 +433,10 @@ export default tseslint.config( 'jest/valid-expect': 'error', }, }, - // test file specific configuration + // vitest-specific configuration { files: vitestFiles, rules: { - '@typescript-eslint/no-empty-function': [ - 'error', - { allow: ['arrowFunctions'] }, - ], - '@typescript-eslint/no-non-null-assertion': 'off', - '@typescript-eslint/no-unsafe-assignment': 'off', - '@typescript-eslint/no-unsafe-call': 'off', - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-return': 'off', 'vitest/no-alias-methods': 'error', 'vitest/no-disabled-tests': 'error', 'vitest/no-focused-tests': 'error',