What Prettier Is and Isn't
You'll learn: How Prettier differs fundamentally from ESLint by formatting style, not checking code quality.
The Core Distinction
Now that you've learned about ESLint and linting, it's crucial to understand what Prettier is: an opinionated code formatter, not a linter. This distinction matters enormously.
ESLint analyzes your code for problems—bugs, anti-patterns, unused variables, potential errors. It checks code quality. ESLint can enforce some style rules (like spacing), but that's not its primary purpose.
Prettier only cares about how your code looks—indentation, line length, quote styles, trailing commas. It enforces consistent formatting automatically. Prettier doesn't care if your logic is broken, if you have unused variables, or if you're using deprecated functions.
The Opinionated Part
Prettier is deliberately opinionated, meaning it provides very few configuration options. You don't debate tabs vs. spaces endlessly—Prettier makes a choice and enforces it. This eliminates bikeshedding debates on teams and ensures everyone's code looks the same.
The Analogy
Think of ESLint as a code reviewer who says, "This function might return undefined," or "You declared this variable but never used it."
Prettier is like an auto-formatter in a word processor—it just makes everything neat and aligned, but it doesn't check if your sentences make sense.
They Work Together
In modern JavaScript projects, you typically use both: ESLint for quality rules, Prettier for formatting. They complement each other when properly configured.
Key Takeaway: Prettier is a code formatter that enforces consistent style automatically—it's not a linter and doesn't check code quality or catch bugs.