Prettier can make your code beautiful or silently ruin your workflow if you don’t configure it correctly.

Introduction
Prettier is like the coffee machine of modern web development; everyone uses it, but very few understand how it actually works.
Most developers install it, turn on “Format on Save,” and move on.
But here’s the uncomfortable truth:
If you just installed Prettier and never configured it, you’re probably using it wrong.
And no, this isn’t about tabs vs spaces, it’s about understanding how Prettier really fits into your workflow, how it interacts with ESLint, and how it can make or break your team’s code consistency.
By the end of this post, you’ll know:
- The common mistakes developers make with Prettier
- The right way to configure and integrate it
- How to stop fighting your formatter and make it work for you
1. What Prettier Actually Does (and Doesn’t Do)
Let’s start by clearing up one huge misconception:
Prettier does not improve your code quality.
It doesn’t find bugs. It doesn’t optimize logic.
What it does do is make your code consistently formatted, no matter who writes it.
Think of it like automatic grammar correction for code.
It doesn’t change what you said; it just makes it easier to read.
Example
❌ Without Prettier:
function greet(name){console.log('hello '+ name)}
✅ With Prettier:
function greet(name) {
console.log("hello " + name);
}
Both versions work.
But one is easier to read, scan, and maintain, and that’s what Prettier is all about.
2. The #1 Mistake: Letting Prettier and ESLint Fight Each Other
If you’ve ever seen an endless loop of “auto-fix → reformat → revert → reformat again,” you’ve experienced tool conflict hell.
It happens because developers often install Prettier and ESLint, both trying to format the code, and neither knows who’s in charge.
To fix it, you need to make Prettier the formatter and ESLint the rule enforcer.
Here’s how to make them play nicely together 👇
Step 1: Install Prettier + ESLint integration
npm install --save-dev eslint-config-prettier eslint-plugin-prettier
Step 2: Update .eslintrc
{
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
✅ ESLint will now use Prettier’s rules for formatting and only focus on real problems (unused vars, undefined imports, etc.).
No more tug-of-war between linters and formatters.
3. The #2 Mistake: Relying on Defaults
Most developers never even create a .prettierrc file.
That means they’re unknowingly using Prettier’s global defaults, which might not match your team’s style or project conventions.
To take control, create a .prettierrc file at your project root:
{
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"printWidth": 100,
"trailingComma": "es5",
"arrowParens": "always"
}
Now your formatting is predictable, explicit, and consistent, no surprises when someone else opens your project.
💡 Tip: Always commit your .prettierrc file to Git. That’s how teams ensure everyone formats the same way.
4. The #3 Mistake: Not Using .prettierignore
Here’s something many developers miss:
Prettier will format everything unless you tell it not to.
That includes build folders, JSON configs, and auto-generated files, which can cause huge slowdowns.
Create a .prettierignore file like this:
node_modules
dist
build
coverage
package-lock.json
.next
This keeps your formatting focused only on the files that matter.
5. The #4 Mistake: Forgetting “Check Mode”
Prettier’s hidden gem is the --check flag.
While --write formatting files, it --check only verifies that your files are already formatted.
npx prettier --check .
This is perfect for CI/CD pipelines or Git pre-commit hooks, because it prevents unformatted code from sneaking into the repo.
Combine it with Husky and Lint-Staged for full automation:
{
"lint-staged": {
"*.{js,ts,jsx,tsx,css,html,md}": "prettier --check"
}
}
Result?
Every time someone commits, Prettier automatically ensures everything follows your style guide.
6. The #5 Mistake: Not Syncing Editor Settings
VS Code users, this one’s for you.
You might have Prettier installed, but if it’s not the default formatter, it won’t run automatically.
Here’s how to fix that.
Open your settings (JSON view) and add:
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"prettier.requireConfig": true
}
✅ This ensures:
- Only Prettier handles formatting.
- It only runs where you have a
.prettierrc(avoids random formatting). - Code formats automatically every time you hit Save.
7. The #6 Mistake: Ignoring Line Endings
This one burns teams silently, especially across Windows and macOS.
Different OSs use different line endings (CRLF vs LF), and Prettier might rewrite them inconsistently, leading to “ghost diffs” in Git.
Fix it by setting this in. .prettierrc:
{
"endOfLine": "lf"
}
And in .gitattributes:
* text eol=lf
Now your commits stay clean, no more mysterious “modified” lines when nothing changed.
8. The #7 Mistake: Not Automating Formatting
If you’re still manually running Prettier, you’re doing extra work.
Add scripts to your package.json:
"scripts": {
"format": "prettier --write .",
"check-format": "prettier --check ."
}
Now you can quickly format or validate your entire project:
npm run format
npm run check-format
Pair that with Husky pre-commit hooks and you’ll never have to think about formatting again.
9. The #8 Mistake: Treating Prettier Like “Just a Tool”
Prettier isn’t just a utility; it’s a team agreement.
It enforces a single style guide that removes subjective debates like:
- “Do we need semicolons?”
- “Should this wrap or stay on one line?”
- “Spaces before braces?”
Once you adopt it as part of your workflow, it becomes your codebase’s single source of truth for style.
The real benefit isn’t prettier code, it’s fewer arguments and faster reviews.
10. The Right Way to Use Prettier
Let’s summarize the correct setup most professionals use:
Step-by-step
- Install Prettier
npm install --save-dev prettier
2. Create .prettierrc
{
"singleQuote": true,
"semi": false,
"trailingComma": "all"
}
3. Create .prettierignore
node_modules dist build
4. Integrate with ESLint
npm install --save-dev eslint-config-prettier eslint-plugin-prettier
5. Set up VS Code
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
}
6. Automate with Git Hooks
npm install --save-dev husky lint-staged
7. Add to package.json:
{
"lint-staged": {
"*.{js,ts,jsx,tsx}": "prettier --check"
}
}
That’s it. You’ve just built a self-enforcing, zero-effort formatting system used by top engineering teams.
Conclusion
Prettier is one of the simplest tools to install and one of the easiest to misuse.
If you’re not using .prettierrc, .prettierignore, and CI checks, you’re missing out on its true power:
Consistency, automation, and peace of mind.
When used right, Prettier stops being a “formatter” and becomes part of your development culture.
So the question is, are you using Prettier right?
Call to Action
How’s your Prettier setup configured right now?
Drop your .prettierrc Or favorite rule combo in the comments and share this post with your team before your next code review.


Leave a Reply