Add CLI Option to Ignore Passed File Paths in case they are Ignored by eslintignore
See original GitHub issueThe version of ESLint you are using.
6.3.0
The problem you want to solve.
I use lint-staged for running eslint and prettier on each commit. The problem is that I have a few files in my repo that should be ignored by eslint. I have put them into eslintignore, but when I commit, lint-staged will call eslint with all committed files explicitly, i.e. eslint —fix —ext *.{js,ts,tsx} path/to/myfile.tsx path/to/ignored/file.js
. eslint ignores eslintignore for files explicitly passed to the eslint CLI.
Your take on the correct solution to problem.
I would suggest to add a new CLI option to ignore passed files in case they are ignored by eslintignore. Also make sure that even when all passed files are ignored, eslint should still exit with code 0.
I would not solve this on lint-staged‘s side because it is tool agnostic and does not know about how eslint works or how it ignores files.
Are you willing to submit a pull request to implement this change?
Currently not.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:11 (3 by maintainers)
Top GitHub Comments
@robbie-c eslint will exit with a 0 exit code when there are just warnings and no errors, so it works fine with lint-staged. But when one uses
eslint --max-warnings 0
which might be desirable, then it would exit with a non-zero exit code, so yes, in this case it would make sense to have no warning in the case of provided ignored file paths. Since it does not fit the my original issue, could you create a new issue for that?Ok, I created the RFC: https://github.com/eslint/rfcs/pull/38