Skip to content

Commit 2a526cd

Browse files
committed
fix: resolve ESLint parser errors for src/stories after tsconfig split
src/stories was excluded from tsconfig.json (needed for the Storybook v10 moduleResolution: node16 requirement) but ESLint still linted those files — causing "file not found in project" parse errors. Fix: add an overrides block in .eslintrc.js pointing stories files to tsconfig.storybook.json, and add an explicit exclude in tsconfig.storybook.json so it doesn't inherit the parent's exclusion of src/stories.
1 parent 0719206 commit 2a526cd

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

.eslintrc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,13 @@ module.exports = {
3838
'@typescript-eslint/no-empty-object-type': 'warn',
3939
'react/no-deprecated': 'warn',
4040
},
41+
overrides: [
42+
{
43+
files: ['src/stories/**/*.{ts,tsx}'],
44+
parserOptions: {
45+
project: path.resolve(__dirname, './tsconfig.storybook.json'),
46+
tsconfigRootDir: __dirname,
47+
},
48+
},
49+
],
4150
};

tsconfig.storybook.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
4-
"moduleResolution": "bundler",
4+
"moduleResolution": "node16",
55
"noEmit": true
66
},
7-
"include": ["src/stories/**/*", ".storybook/**/*"]
7+
"include": ["src/stories/**/*", ".storybook/**/*"],
8+
"exclude": ["node_modules", "dist"]
89
}

0 commit comments

Comments
 (0)