-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New CLI Option: --select-rule #5377
Comments
Hi @customcommander. That's an interesting idea. I wonder if we could modify the behavior of Alternatively, I've written eslint-nibble, which allows you to easily focus on cleaning up one rule at a time. That may be useful in your situation. (It's also still on eslint 1.x until I get around to updating it.) |
I don't think we need a new option for this. If you have a config file setup the way you want, set each rule's severity to 0 and include whatever other config info for that rule. Then, on the command line, use |
@nzakas That's a bit of a pain though, since you'll have to be constantly re-configuring any options you want on each rule in turn after having turned them all to a |
I think I see the problem. The other rules will also run unless |
I honestly think this is a solved problem: |
I think that's unexpected based on how I'm just not sold on adding a new option for this use case. You can pretty easily create a filter for what ESLint outputs and do the same thing:
|
OK, I'm sold. @customcommander, will one of these suggestions work for you? |
I agree with @nzakas, that would be confusing. That's why I thought that a new rule would make more sense here: Assuming that adding a new cli option is definitely off the table, what about a formatter that would group errors and warnings by rules instead of by files? Example: new-cap strict etc. |
@customcommander, did you take a look at eslint-nibble? It uses eslint-stats under the hood. You could take a look at that as a starting point if you wanted to create a reporter to group by rule. |
Yep something along those lines would work for me. However I don't need something interactive, a simple formatter would be enough, and also I'd rather depend on the original package than on a wrapper (no offence). Why not contributing some of it back to |
Yeah I understand. It's really intended to just be something you run when you're introducing ESLint to a project, and then for maintenance it's of course best to switch to ESLint directly, as you say. If you write a formatter I bet we would consider rolling it into core. And even if it isn't part of core, you can still share and use it as a custom formatter. |
OK I'll give it a go and see what happens :-) |
I think the right approach fit note is to create a custom formatter. If we get other requests for the same thing, we can look at rolling a solution into core. |
Sounds reasonable. Thanks guys. (I'm working on it btw) |
Please note this issue is useful with the |
@rapilabs, I had a similar issue and followed the advice by @platinumazure in #6333. |
It'd be great to have this issue reopened for consideration. All the workarounds proposed here don't help if you want to selectively In our case we have a pretty complex If we run with Let's take a simple example,
You get WAAAAY different results than if you use our main I ended up working around this, but it was a little gross. I ran TL;DR I think it'd be great if core supported taking a fully formed configuration and then selectively running a single rule. |
Hi guys,
We have started to introduce ESLint on a couple of fairly large code bases and the rules we have established generate thousands of errors and warnings :-)
I tend to fix on a rule by rule basis but I find it a bit cumbersome sometimes as I need to copy the rule from the
eslintrc.json
file, wrap it in a json-like string and paste it to the command line. e.g.:It would be easier if I could just pick a rule from my config (or the compiled config):
Is there a way to achieve this already? Does that seem a good idea?
Thanks
PS: I'm running the latest ESLint on the 1.x branch
The text was updated successfully, but these errors were encountered: