What Is a Linter?

A linter is a tool that statically analyzes source code to flag potential errors, stylistic inconsistencies, and patterns known to cause bugs, without actual...

Published October 8, 2026

A linter is a tool that analyses source code without running it to find bugs, style problems and risky patterns. ESLint (JavaScript), Pylint (Python) and PHPStan (PHP) are common examples.

The concept

Linters parse code into a syntax tree and check it against rules: unused variables, unreachable code, inconsistent style.

They run in the editor and in CI, enforcing team conventions and catching mistakes before review.

Lint output

npx eslint src
src/app.js 12:7 warning 'tmp' is assigned a value but never used
src/app.js 20:3 error Unexpected console statement

Practical examples

ESLint config

{ "extends": "eslint:recommended", "rules": { "no-console": "error" } }

Auto-fix

npx eslint . --fix

Run in CI

- run: npx eslint . --max-warnings=0

Common mistakes

  • Disabling rules instead of fixing issues.
  • Fighting formatters and linters (use Prettier plus eslint-config-prettier).
  • Ignoring warnings until there are thousands.

Key takeaways

  • Linters catch issues statically.
  • Run in editor and CI.
  • Auto-fix what you can.

FAQ

Linter vs formatter?

Linters find problems; formatters only change layout.

Is TypeScript a linter?

No, it checks types; use both.

More General articles