Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run eslint for a single rule

Tags:

How do I run eslint for a single rule? I want to fix one at a time on a code base with many errors.

Something like: eslint --rule no-def path/

like image 584
Rimian Avatar asked Feb 14 '19 02:02

Rimian


People also ask

How do you set rules in ESLint?

ESLint comes with a large number of built-in rules and you can add more rules through plugins. You can modify which rules your project uses either using configuration comments or configuration files. To change a rule setting, you must set the rule ID equal to one of these values: "off" or 0 - turn the rule off.

How many ESLint rules are there?

Keep in mind that we have over 200 rules, and that is daunting both for end users and the ESLint team (who has to maintain them).

How do I run ESLint autofix?

Set up ESLint to autofix files To enable running eslint --fix on save for the current project, go to Preferences / Settings | Languages and Frameworks | JavaScript | Code Quality Tools | ESLint and tick the Run eslint --fix on save checkbox. By default, WebStorm will run ESLint to autofix . js, . ts, .


1 Answers

eslint --no-eslintrc --rule "no-undef: 2" path

See --rule and --no-eslintrc.

like image 194
vsemozhebuty Avatar answered Sep 18 '22 22:09

vsemozhebuty