Skip to content
Latchkey

What Is ESLint? The JavaScript Linter Explained

ESLint is a linter that statically analyzes JavaScript and TypeScript to catch likely bugs and enforce consistent code style before code ever runs.

ESLint reads your code without running it and flags patterns that are probably mistakes or that violate your team's conventions. It is highly configurable through rules and plugins, and it has become a standard quality gate in JavaScript and TypeScript pipelines.

What ESLint is

ESLint is a pluggable static analysis tool for JavaScript and TypeScript. It parses code into an AST and runs a configurable set of rules over it, reporting problems as warnings or errors. Plugins extend it for frameworks (React, Vue) and TypeScript-specific checks.

Rules and configuration

Each rule checks one thing, such as disallowing unused variables or requiring a specific import order. You enable rules and set their severity in a config file (flat config or the older .eslintrc), often extending a shared preset. Many rules are auto-fixable with "eslint --fix", which rewrites code to satisfy them.

A usage example

Lint a directory and auto-fix what can be fixed.

Common ESLint commands
# report problems
npx eslint src/

# auto-fix the fixable ones
npx eslint src/ --fix

Role in CI/CD

In CI, ESLint runs as a quality gate that exits non-zero when errors are found, failing the build on rule violations. Running it with "--max-warnings 0" turns warnings into hard failures for strictness. Because linting is fast and catches issues early, it is usually one of the first checks in a pipeline, before tests.

Alternatives

Biome and Oxlint are newer, much faster Rust-based linters that aim to replace ESLint and Prettier for speed. TSLint was the old TypeScript linter, now deprecated in favor of ESLint. ESLint remains the standard thanks to its vast rule and plugin ecosystem.

Key takeaways

  • ESLint statically analyzes JS/TS to catch bugs and enforce style.
  • Rules are configurable, and many issues are auto-fixable with --fix.
  • In CI it fails the build on errors; run it early as a fast quality gate.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →