Skip to content
BENIBIX Learn

ESLint

Development🛠️ Editors & ToolsCode Quality Tools

Also known as ES Lint, eslint.config.js, JavaScript Linter

A free tool that checks JavaScript code for slips. It does not run the code.

Think of it like

It is like a teacher who marks your homework. She circles each slip and says what is wrong.

Example

Jack runs ESLint before he pushes. It warns that he made a variable called total and never used it.

Why it matters

It catches small slips before they reach users. Teams also use it to keep everyone's code in one style.

Definition

ESLint is a free linter for JavaScript and TypeScript. It reads your code without running it and points out problems. It finds things like a variable you never use, or code that can never run. Each check is a rule, and you turn rules on or off in a file called eslint.config.js. Many problems it can fix by itself.

Example code

console
$ npx eslint app.js
  3:7  error  'total' is assigned a value but never used  no-unused-vars
ESLint names the line, the problem and the rule that found it.
ESLint puts a line under the slip in the editor as you type.

Common mistake

Turning a rule off each time it fires. Read why it fired first, since most warnings point at a real slip.

Key takeaways

  1. 1
    Reads, does not run. It checks the code as text.
  2. 2
    Rules you choose. Turn each check on or off in the config.
  3. 3
    Fixes some for you. Run it with --fix for the simple ones.

Compare

Learn it properly