Skip to content

Commit 6352827

Browse files
committed
Configure ESLint to lint test files
- Use project array instead of projectService for multiple tsconfig support - Relax rules for test files (line-comment-position, unicorn/consistent-function-scoping, no-undef) - Test files have different conventions than production code Fixes ESLint parsing errors for test directory.
1 parent f4c8079 commit 6352827

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

.config/eslint.config.mjs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -239,20 +239,11 @@ function configs(sourceType) {
239239
parser: tsEslint.parser,
240240
parserOptions: {
241241
...importFlatConfigs.typescript.languageOptions?.parserOptions,
242-
projectService: {
243-
...importFlatConfigs.typescript.languageOptions?.parserOptions
244-
?.projectService,
245-
allowDefaultProject: [
246-
// Add constants type definitions.
247-
'registry/src/lib/constants/*.d.ts',
248-
],
249-
defaultProject: 'tsconfig.json',
250-
// PERFORMANCE TRADEOFF: Increase file match limit from default 8 to 1000.
251-
// This slows initial parsing but allows TypeScript-aware linting of all
252-
// npm package overrides without requiring individual tsconfig files.
253-
maximumDefaultProjectFileMatchCount_THIS_WILL_SLOW_DOWN_LINTING: 1000,
254-
tsconfigRootDir: rootPath,
255-
},
242+
project: [
243+
path.join(rootPath, 'tsconfig.json'),
244+
path.join(rootPath, 'tsconfig.test.json'),
245+
],
246+
tsconfigRootDir: rootPath,
256247
},
257248
},
258249
plugins: {
@@ -354,11 +345,14 @@ export default [
354345
},
355346
},
356347
{
357-
// Disable import resolution rules for test files importing from scripts.
358-
files: ['test/**/*.ts'],
348+
// Relax rules for test files - testing code has different conventions
349+
files: ['test/**/*.ts', 'test/**/*.mts'],
359350
rules: {
360351
'n/no-missing-import': 'off',
361352
'import-x/no-unresolved': 'off',
353+
'line-comment-position': 'off',
354+
'unicorn/consistent-function-scoping': 'off',
355+
'no-undef': 'off', // TypeScript handles this
362356
},
363357
},
364358
{

0 commit comments

Comments
 (0)