Lint-staged throwing ESLint warning for ignored Storybook config file
Asked Answered
I

1

1

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?

Individuate answered 28/6, 2023 at 11:6 Comment(1)
I'm also experiencing exact same issues. I tried the same trouble shootings as you described. I'm also out of ideas...Ventre
P
1

In your eslint configuration add an ignorePatterns key.

For instance add this to your .eslintrc.json:

{
  ...
  "ignorePatterns": ["!.storybook"]
  ...
}
Plante answered 21/7, 2023 at 0:16 Comment(1)
This works, great! But why is it necessary to explicitly include the .storybook folder? Is it because of the leading dot in the folder name? Something else?Hirohito

© 2022 - 2024 — McMap. All rights reserved.