LinuxCommandLibrary

eslint

Lint JavaScript files

TLDR

Lint JavaScript files

$ eslint [file.js]
copy
Lint directory recursively
$ eslint [src/]
copy
Fix auto-fixable issues
$ eslint --fix [file.js]
copy
Specify config file
$ eslint -c [.eslintrc.json] [file.js]
copy
Output in specific format
$ eslint -f [json] [file.js]
copy
Initialize configuration
$ eslint --init
copy
Lint with extensions
$ eslint --ext [.js,.jsx,.ts,.tsx] [src/]
copy

SYNOPSIS

eslint [options] [files|dirs]

DESCRIPTION

ESLint is the standard linting tool for JavaScript and TypeScript. It statically analyzes code to find problems, enforce coding standards, and catch bugs before runtime.
Rules are highly configurable through .eslintrc files. Plugins extend functionality for React, Vue, TypeScript, and other frameworks. The --fix flag automatically corrects many issues.
ESLint integrates with editors and CI systems, making it central to JavaScript development workflows.

PARAMETERS

FILES

Files or directories to lint.
--fix
Automatically fix problems.
-c, --config FILE
Configuration file.
-f, --format FORMAT
Output format.
--ext EXTENSIONS
File extensions to check.
--init
Create configuration file.
--cache
Cache results for faster runs.
--quiet
Report errors only.
--help
Display help information.

CAVEATS

Configuration can be complex. Plugin compatibility varies. Flat config vs legacy config transition. Large codebases may be slow without caching.

HISTORY

ESLint was created by Nicholas C. Zakas in 2013 as a more pluggable and configurable alternative to JSHint. It became the dominant JavaScript linter due to its extensibility.

SEE ALSO

prettier(1), tsc(1), jshint(1)

Copied to clipboard