Linter vs Formatter
A linter reads code and warns about likely bugs. A formatter only fixes spaces and line breaks, and never what code does.
Linter
A tool that reads code without running it. It points out likely slips.
A linter reads your code without running it and points out likely mistakes. It catches things like a variable you never use, a name that is spelled two ways or a risky pattern. It can also check that the code follows the team's style rules. ESLint for JavaScript and Ruff for Python are common ones. Most run inside the editor and mark problems as you type.
Code Formatter
A tool that fixes the layout of code, like spaces and line breaks, to one style.
A code formatter rewrites your code so its layout follows one fixed style. It sets the spaces, line breaks, quotes and indents. It never changes what the code does, only how it looks. Prettier for JavaScript and Black for Python are well known. Teams run it on every save, so nobody argues about spacing again.
In one line
- Linter
- A tool that reads code without running it. It points out likely slips.
- Code Formatter
- A tool that fixes the layout of code, like spaces and line breaks, to one style.