Linter fails after adding storybook config files
See original GitHub issueCurrent Behavior
Linting a library which has storybook configurations causes lint errors.
Expected Behavior
Linter should success without errors.
Steps to Reproduce
- Create a workspace
npx create-nx-workspace workspace
? What to create in the new workspace react
? Application name web
? Default stylesheet format emotion
? Use Nx Cloud? (It's free and doesn't require registration.) No
Creating a sandbox with Nx...
- Add a library
npm run nx g lib components
- Add Storybook configurations
npm i -D @nrwl/storybook
npm run nx g storybook-configuration components
? Configure a cypress e2e app to run against the storybook instance? Yes
? Automatically generate story files for components declared in this library? Yes
? Automatically generate *.spec.ts files in the cypress e2e app generated by the cypress-configure schematic? Yes
- Run lint
npm run lint components
Failure Logs
> nx workspace-lint && nx lint "components"
> nx run components:lint
Linting "components"...
/Users/puku0x/Desktop/workspace/libs/components/.storybook/main.js
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: libs/components/.storybook/main.js.
The file must be included in at least one of the projects provided
/Users/puku0x/Desktop/workspace/libs/components/.storybook/preview.js
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: libs/components/.storybook/preview.js.
The file must be included in at least one of the projects provided
/Users/puku0x/Desktop/workspace/libs/components/.storybook/webpack.config.js
0:0 error Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: libs/components/.storybook/webpack.config.js.
The file must be included in at least one of the projects provided
✖ 3 problems (3 errors, 0 warnings)
Lint errors found in the listed files.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! workspace@0.0.0 lint: `nx workspace-lint && nx lint "components"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the workspace@0.0.0 lint script.
Environment
> NX Report complete - copy this into the issue template
nx : Not Found
@nrwl/angular : Not Found
@nrwl/cli : 10.3.0
@nrwl/cypress : 10.3.0
@nrwl/eslint-plugin-nx : 10.3.0
@nrwl/express : Not Found
@nrwl/jest : 10.3.0
@nrwl/linter : 10.3.0
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : 10.3.0
@nrwl/schematics : Not Found
@nrwl/tao : 10.3.0
@nrwl/web : 10.3.0
@nrwl/workspace : 10.3.0
typescript : 4.0.3
Issue Analytics
- State:
- Created 3 years ago
- Reactions:10
- Comments:21 (9 by maintainers)
Top Results From Across the Web
Storybook fails on eslint errors in react - Stack Overflow
In my case I just wanted to disabled eslint errors during development so. DISABLE_ESLINT_PLUGIN=true start-storybook -p 6006 -s public.
Read more >How to use Storybook with ESLint - JS.ORG
If you already use ESLint in your project, first try Storybook's automigration to add and configure the linter automatically for you:
Read more >React & Typescript & Storybook - SemiSafeForWork
React; TypeScript; ESLint; AirBnB lint rules ... augmented with a simple update to the .storybook/config.js file (specifically \.stories\.
Read more >How I solved and debugged my Webpack issue through trial ...
I knew that Webpack was not easy to configure: there are many parts with many ... bundle.js ) and one of the source...
Read more >Ignoring Code - ESLint - Pluggable JavaScript Linter
Add ignorePatterns to a configuration file. Create a dedicated file that contains the ignore patterns ( .eslintignore by default). ignorePatterns in Config ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It can be solved by modifying
ignorePatterns
in.eslintrc.json
.When dealing with an Angular library that has Storybook files, the issue may also pop up:
To fix the issue, simply add your Storybook’s
tsconfig.json
toparserOptions.project
in your library’s.eslintrc.json
file.Before:
After:
Happy linting!