Definition
What it is
A linter reads source code without executing it and reports patterns that are stylistically wrong, structurally suspicious or likely bugs. It does not prove correctness. It catches the class of problems that a compiler accepts but a reviewer would flag: unused variables, unreachable branches, shadowed identifiers, inconsistent imports, missing semicolons in languages that require them, duplicate keys in objects.
The verb and the noun are the same: to lint code, you run a linter. The output is a list of findings, each with a line, a column and a rule identifier.
Why it matters
Code review time is the most expensive resource in a healthy engineering team. A linter handles the mechanical layer for free: it never gets tired, it never has opinions about architecture, it never negotiates. What it does, it does in milliseconds, on every save, on every commit, on every pull request. Reviewers then spend their time on the parts that a linter cannot judge: naming, abstraction, contract, coupling.
Static vs runtime analysis
Aspect | Lint (static) | Tests (runtime) |
|---|---|---|
Requires execution | No | Yes |
Speed | Milliseconds | Seconds to hours |
Catches syntax errors | Yes | Only if the code reaches them |
Catches logic errors | Sometimes, by pattern | Yes, if a test covers them |
Catches performance issues | Rarely | Sometimes, under load |
False positives | Common | Rare |
Where lint sits in the pipeline
graph LR A[Save in editor] -->|linter on save| B[Finding shown inline] B --> C[Commit] C -->|pre-commit hook| D[Linter runs] D --> E[Pull request] E -->|CI lint stage| F[Linter runs again] F --> G[Merge] style A fill:#E8F5E9 style G fill:#E8F5E9
How to adopt lint without drowning
Adopting a linter on an existing codebase
Start with the recommended preset
Every serious linter ships a preset. Turn it on. Do not customize yet.
Fix what it flags, do not silence
Silencing a rule with a comment is fine for a specific line, never for a file.
Add one rule at a time
One rule, one pull request, one discussion. Adoption is a conversation, not a decree.
Fail the build on error, not on warning
Warnings that do not fail the build get ignored within a week.
Origin
The first linter was written by Stephen C. Johnson at Bell Labs and published in July 1978 as Lint, a C Program Checker (Computer Science Technical Report 65). It scanned C source for constructs that the portable C compiler accepted but that were likely to be bugs: unused variables, inconsistent argument counts, unreachable code, suspicious type conversions. Johnson named it after the small fibers that cling to fabric. The metaphor stuck, and "lint" became the generic term for any static code checker.
The name "lint" was chosen because the program picked up the small bits of fluff that clung to a programmer's code the way lint clings to a suit.
— Stephen C. Johnson, quoted in *The Practice of Programming* (Kernighan & Pike, 1999)
Evidence
FAQ
- Linter vs compiler?
The compiler translates code; a linter critiques code. Many linters run inside compilers now (Go's vet, Rust's clippy, TypeScript's --strict).
- Does lint slow development?
On save, it is invisible. On a pre-commit hook, it takes a second. In CI, it takes a few seconds. The cost is far below a broken build.
- Which linter to pick?
The one with the most maintained rules for your language and the most adoption in your community. ESLint for JavaScript, PHP_CodeSniffer and PHPStan for PHP, clippy for Rust, golangci-lint for Go.
- Can a project run without a linter?
Yes, and many do. They compensate with stronger review and slower releases. Lint is a shortcut, not a requirement.
Connections
- static-analysis
- compiler
- code-review
- ci-pipeline
- technical-debt
Johnson, S. C. (1978). Lint, a C Program Checker. Bell Laboratories TR 65. https://www.talisman.org/~erlkonig/misc/lint.1.html
Wikipedia (2024). Lint (software). https://en.wikipedia.org/wiki/Lint_(software)
ESLint project (2024). ESLint documentation — About. https://eslint.org/docs/latest/
Etymology
Origin: metaphor
lint(noun): small fibers that cling to fabric, from Old English lynnet, flax
Semantic network
● broader ● narrower ● related
Broader
static-analysissoftware-quality
Related
static-analysiscompilercode-revieweslintphpstan
Sources
Johnson, S. C. (1978). Lint, a C Program Checker. https://www.talisman.org/~erlkonig/misc/lint.1.html
Wikipedia (2024). Lint (software). https://en.wikipedia.org/wiki/Lint_(software)
ESLint project (2024). ESLint documentation. https://eslint.org/docs/latest/