Can Prettier check for code errors?
No. Prettier does not check for code errors. Its job is formatting only. It does not analyze logic, does not look for bugs, and does not check whether the code works correctly. Prettier only cares about appearance.
What it does
- adds or removes
; - picks quotes
'or" - formats indentation
- wraps lines
- brings the code to a consistent style
Prettier = outward beauty and consistency.
What it does NOT do
- does not find bugs
- does not see incorrect conditions, loops, or comparisons
- does not check variables
- does not catch runtime errors
- does not warn that the code might crash
Prettier is not a linter. It cannot analyze logic.
Who checks for errors
For that you need ESLint (or TypeScript, for type errors). ESLint:
- finds dangerous constructs
- checks for potential errors
- points out incorrect practices
Summary
| Tool | What it is responsible for |
|---|---|
| Prettier | Formats code, takes care of style |
| ESLint | Checks quality and errors |
Prettier is cosmetics, ESLint is diagnostics.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.