Two tools, two jobs
A linter and a formatter both improve code quality but solve different problems. A linter analyzes code for likely bugs and questionable patterns, such as an unused variable or a missing dependency. A formatter rewrites code to a consistent style, like spacing and quotes, without changing behavior.
- Linter: flags risky patterns and possible mistakes.
- Formatter: reshapes whitespace and punctuation automatically.
- Lint rules judge meaning, formatting rules judge appearance.
Why split them
Keeping style out of the linter avoids endless debates and lets each tool do one job well. The formatter ends arguments about brace placement by deciding for everyone, and the linter focuses on substance like correctness rules.
- Run the formatter on save so style is never hand maintained.
- Treat lint errors as signals about real risks to review.
- Wire both into the editor and the pipeline for consistency.
The payoff is fewer review comments about trivia and more attention on logic. Diffs stay small because formatting never drifts, and bugs surface earlier because the linter complains before the code ever runs.
Key idea
A linter flags likely bugs and bad patterns while a formatter auto enforces style, so each tool stays focused on one job.