Create ESLint config

$ eslint --init

Lint on a given set of files
$ eslint [filename].js [filename1].js

Fix lint issues
$ eslint --fix

Lint with config
$ eslint -c [path/to/config_file] [app/src]


eslint [options] file.js [file.js] [dir]

Basic configuration:


Disable use of configuration from .eslintrc.*

-c, --config path::String

Use this configuration, overriding .eslintrc.* config options if present

--env [String]

Specify environments

--ext [String]

Specify JavaScript file extensions - default: .js

--global [String]

Define global variables

--parser String

Specify the parser to be used

--parser-options Object

Specify parser options

Specifying rules and plugins:

--rulesdir [path::String]

Use additional rules from this directory

--plugin [String]

Specify plugins

--rule Object

Specify rules

Fixing problems:


Automatically fix problems


Automatically fix problems without saving the changes to the file system

--fix-type Array

Specify the types of fixes to apply (problem, suggestion, layout)

Ignoring files:

--ignore-path path::String

Specify path of ignore file


Disable use of ignore files and patterns

--ignore-pattern [String]

Pattern of files to ignore (in addition to those in .eslintignore)

Using stdin:


Lint code provided on <STDIN> - default: false

--stdin-filename String

Specify filename to process STDIN as

Handling warnings:


Report errors only - default: false

--max-warnings Int

Number of warnings to trigger nonzero exit code - default: -1


-o, --output-file path::String

Specify file to write report to

-f, --format String

Use a specific output format - default: stylish

--color, --no-color

Force enabling/disabling of color

Inline configuration comments:


Prevent comments from changing config or rules


Adds reported errors for unused eslint-disable directives



Only check changed files - default: false

--cache-file path::String

Path to the cache file. Deprecated: use --cache-location - default: .eslintcache

--cache-location path::String

Path to the cache file or directory



Run config initialization wizard - default: false


Output debugging information

-h, --help

Show help

-v, --version

Output the version number

--print-config path::String

Print the configuration for the given file

Copied to clipboard