javascriptnode.jseslint

How do you run eslint for only a specific rule or set of rules - command line only


I know you can define rules in an .eslintrc file, but what if I just want to run eslint and check for one specific rule?

E.g. $ eslint helpme.js --rule some-important-rule


Solution

  • I don't know if this is the best way, but I was able to get this working:

    $ eslint helpme.js --no-eslintrc --env "es6" --env "node" --parser-options "{ecmaVersion: 2018}" --rule "{some-important-rule: error}"

    Note: With this method (ignoring .eslintrc completeley) you still have to add some stuff from .eslintrc like your environment and parser options.