Question: Considering `.eslintignore`
See original GitHub issueDescription
It sems that with this configuration:
"lint-staged": {
"*.js": ["eslint --fix", "git add"]
}
eslint does NOT consider any .eslintignore
, thus I get errors for files which are in folders that have an .eslintignore
.
I have corrected this by doing this:
"lint-staged": {
"*.js,.eslintignore": ["eslint --fix", "git add"]
}
Is this the correct way to configure this? Should this be a default behaviour? Maybe worth adding this to the example configs?
Thanks.
Steps to reproduce
Debug Logs
Environment
Issue Analytics
- State:
- Created 5 years ago
- Reactions:11
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Turning off eslint rule for a specific file - Stack Overflow
1) Disabling "All rules" · You can go with 1.2 and add /* eslint-disable */ on top of the files, one by one....
Read more >Webstorm doesn't apply ESLint – IDEs Support (IntelliJ Platform)
First of all I've been assuming it would be a problem with ESLint's ... Please look for .eslintignore in your /Users/Mesut/workspace folder.
Read more >lint-staged - npm
This config will execute your-cmd with the list of currently staged files passed as arguments. So, considering you did git add file1.ext file2....
Read more >student-question - npm Package Health Analysis - Snyk
Learn more about student-question: package health score, ... project maintenance signal to consider for student-question is that it hasn't ...
Read more >ESLint - Quasar Framework
.eslintrc.js – ESLint configuration, including rules .eslintignore – what ESLint should ... consider switching to `plugin:vue/strongly-recommended` or ...
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 FreeTop 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
Top GitHub Comments
@okonet I’m having a similar issue: I have an
.eslintignore
file.If I run
eslint
on it’s own with--max-warnings 0
, it respects the.eslintignore
and I get no warningsHowever, if I run the same command in
lint-staged
, it does not take into account the.eslintignore
and throws the warningsHere’s the command I’m running:
Here it is in
lint-staged
:Here is the warning log when run from
lint-staged
:For those traveling through the issues in future (like me for last couple hours):
@kunalnagar answer above was very helpful, but I had to adjust it to consider 2 .eslintrc configs I had (root and for cypress):