Lint-staged throwing ESLint warning for ignored Storybook config file

588 Views Asked by At

I am currently developing a component library in React within a mono-repository. I have the lint-staged package to run my linting and unit testing NPM scripts when I make a commit to the repository.

I'm currently experiencing a warning "File ignored by default. Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override" for .storybook/main.js.

I have tried adding !./storybook/* to my .eslintignore file but I'm now out of ideas.

If I run yarn lint from the command line then I do not see the same error so it seems something very specific to lint-staged. Any ideas?

1

There are 1 best solutions below

1
akumapunk On

In your eslint configuration add an ignorePatterns key.

For instance add this to your .eslintrc.json:

{
  ...
  "ignorePatterns": ["!.storybook"]
  ...
}