Run single rule *without* using `--no-eslintrc`
See original GitHub issueThe version of ESLint you are using.
6.5.1
The problem you want to solve.
I would like to be able to run a single ESLint rule, but without having to repeat all the other setup config that is in my root .eslintrc.js
file.
My specific use case is running a single file on a TypeScript file, something like this:
console.log('foo');
debugger;
export enum Numbers {
one,
two,
three,
four
}
Running eslint --no-eslintrc --rule no-debugger:error
fails on this file with a parsing error (the enum).
Running eslint --rule no-debugger:error
runs all the other rules defined in the extends
part of my root .eslintrc.js
file.
This problem is not isolated to the CLI, but also the JS API, which I am currently using.
Your take on the correct solution to problem.
I believe I could use the JS API to do resolveFileGlobPatterns()
and use getConfigForFile()
for each file and then modify the result to just set the one rule I want, but that seems like it would be really slow. Is that the correct approach? Is there something I am missing?
Are you willing to submit a pull request to implement this change?
Yes, happy to give it a crack!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top GitHub Comments
Unfortunately, it looks like there wasn’t enough interest from the team or community to implement this change. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach accepted status after 21 days tend to never be accepted, and as such, we close those issues. This doesn’t mean the idea isn’t interesting or useful, just that it’s not something the team can commit to.
Thanks for contributing to ESLint and we appreciate your understanding.
Also, since this is a change to core, I think this proposal should go through the RFC process outlined here.