IanVS / eslint-nibble

Ease into ESLint, by fixing one rule at a time
MIT License
787 stars 29 forks source link

Run a specific rule from the cli #95

Closed polaroidkidd closed 2 years ago

polaroidkidd commented 2 years ago

Hi

  1. Loving this tool! It's saving me from a lot of head-aches.
  2. I've looked through the readme, but I'm not sure I understand the --non-interactive flag correctly. Does this mode allow me to specify a rule in the cli which nibble would auto-fix?

I have a monorepo with 28 apps in it and navigating into every app one-at-a-time is a bit of pain. I've tried using the rule in combilation with the --rule flag but the desired outcome isn't quite there yet.

ljharb commented 2 years ago

47?

polaroidkidd commented 2 years ago

I've tried running it with the --rule flag, but it still asks me to confirm the rule and then asks me if I want to automatically fix it. Am I using it incorrectly, not seeing something or is this not a feature?

IanVS commented 2 years ago

@polaroidkidd Yes you should be able to specify something like eslint-nibble . --non-interactive --rule semi In order to run eslint against your code, using your project config, but only for the "semi" rule. If that's not working, can you share the full command that you are running?

IanVS commented 2 years ago

Are you trying to automatically fix a particular rule? If so, https://github.com/IanVS/eslint-filtered-fix might be what you're looking for (it's what eslint-nibble uses under-the-hood).

polaroidkidd commented 2 years ago

yes, that's the end goal. Thanks for pointing eslint-filted-fix out! Closing this as it was a misunderstanding on my part. Thanks again!

IanVS commented 2 years ago

Great, I hope that meets your needs, and let me know if you hit any other issues. Since you have such a large project, I'll point out I recently became aware of that https://github.com/mizdra/eslint-interactive, which it sounds like might have better performance than eslint-nibble (though maybe not eslint-filtered-fix). If you try that out, I'd be curious to hear your thoughts on it.

mizdra commented 2 years ago

eslint-interactive has a feature called Programmable API. You can probably use it to do the same thing as eslint-filtered-fix (more flexible than eslint-filtered-fix, but the API is not as easy). If you need it, please see below.

polaroidkidd commented 2 years ago

oh, sweet! I passed this on to the team developing our internal react-scripts version as this tool greatly helps migrating the code base I'm managing to the new eslint rules.