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 statically analyzes source code to flag potential errors, stylistic inconsistencies, and patterns known to cause bugs, without actually running the code.

Why it exists

  • Certain classes of mistakes (unused variables, inconsistent formatting, unsafe patterns like using == instead of === in JavaScript) are easy to catch automatically before code review
  • Manually enforcing style and catching these issues in every code review is slow and inconsistent

How to apply it

  • Run a linter (like ESLint, Pylint, or PHP_CodeSniffer) automatically as part of your build or a pre-commit hook, not just occasionally by hand
  • Configure rules to match your team's actual standards — a linter with rules nobody agrees with just gets ignored or disabled

FAQ

Does a linter check whether the code actually works?

No — a linter analyzes code statically without running it, so it catches style and pattern issues, not logical or runtime bugs. That's what tests are for.

More General articles