Skip to content

Commit f574820

Browse files
arbrandesclaude
andcommitted
fix: exclude test files from webpack TypeScript checking
Exclude src/**/*.test.* and src/**/*.spec.* from tsconfig.json so the webpack dev server's ForkTsCheckerWebpackPlugin doesn't type-check them (they use jest globals not available in the webpack context). Add tsconfig.lint.json (extends tsconfig.json, re-includes test files) and point eslint at it so type-aware linting still covers tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4acf1af commit f574820

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

eslint.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,15 @@ module.exports = createLintConfig(
1919
'**/__snapshots__/*',
2020
],
2121
},
22+
{
23+
// Test files are excluded from tsconfig.json to prevent the webpack dev server's
24+
// ForkTsCheckerWebpackPlugin from type-checking them. Use a separate tsconfig for
25+
// eslint that re-includes test files for type-aware linting.
26+
languageOptions: {
27+
parserOptions: {
28+
projectService: false,
29+
project: './tsconfig.lint.json',
30+
},
31+
},
32+
},
2233
);

tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515
"eslint.config.js",
1616
"jest.config.js",
1717
"site.config.*.tsx"
18+
],
19+
"exclude": [
20+
"src/**/*.test.*",
21+
"src/**/*.spec.*"
1822
]
1923
}

tsconfig.lint.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": [
4+
"src/**/*",
5+
"app.d.ts",
6+
"babel.config.js",
7+
"eslint.config.js",
8+
"jest.config.js",
9+
"site.config.*.tsx"
10+
],
11+
"exclude": []
12+
}

0 commit comments

Comments
 (0)