Developers should use Prettier and ESLint together: Prettier should handle formatting, while ESLint should handle code quality, bugs, and project rules. Prettier’s own docs describe it as an opinionated formatter that reprints code using its own rules, which is exactly why it should not be treated as a linter [source: Prettier].
TLDR: Prettier fixes how JavaScript looks; ESLint fixes how JavaScript behaves. A 12-person frontend team can easily lose 5 minutes per developer per day arguing about semicolons, quote styles, and line breaks, which adds up to about 20 hours per month. For example, Prettier can rewrite messy JSX on save, while ESLint warns that a React hook has a missing dependency. The best setup is simple: run Prettier for formatting, ESLint for logic rules, and make both run before code reaches the main branch.
Prettier and ESLint solve different problems
Prettier and ESLint are often compared as if one must replace the other. That comparison is a bit misleading. They overlap in a few small areas, but their real jobs are different.
Prettier is a code formatter. It cares about spacing, wrapping, indentation, quotes, trailing commas, and line width. It does not care whether a variable is unused because of a bug. It does not know whether a promise was handled badly. It formats code and moves on.
ESLint is a linter. It checks JavaScript and TypeScript for patterns that may cause bugs, hard-to-read code, security issues, or broken team rules. It can catch unused variables, accidental globals, unsafe equality checks, missing React hook dependencies, and many other issues.
The annoying part is that both tools can touch style if configured poorly. That is where teams waste time. One tool changes a line. The other complains about that same line. Then a developer runs a command, gets a different result, and loses 10 minutes to config files instead of shipping work.
What Prettier does best
Prettier is best at ending style debates. No one has to argue about whether a chained method should break after 80 or 100 characters. No one has to manually align props in JSX. The formatter does it the same way every time.
Common Prettier tasks include:
- Reformatting JavaScript, TypeScript, JSX, JSON, CSS, HTML, and Markdown.
- Applying consistent indentation and line breaks.
- Standardizing quotes, semicolons, trailing commas, and bracket spacing.
- Running automatically on save in popular editors.
- Running in CI so unformatted code never gets merged.
Prettier is intentionally strict. It offers fewer options than many teams expect. That can feel irritating at first. Still, fewer choices usually mean fewer arguments. A team may dislike one formatting choice, but at least everyone gets the same result.
What ESLint does best
ESLint is strongest when it focuses on correctness and maintainability. It can warn about code that works today but may break later. It can also enforce project rules that Prettier will never understand.
Useful ESLint rules can catch:
- Unused variables that often indicate dead code or mistakes.
- Missing imports or unresolved paths.
- Unsafe comparisons, such as loose equality where strict equality is required.
- React hook mistakes, including missing dependencies.
- TypeScript issues when paired with the TypeScript ESLint parser.
- Team-specific rules, such as banning console logs in production code.
ESLint can also fix some problems automatically with --fix. That sounds similar to Prettier, but the intent is different. ESLint fixes rule violations. Prettier formats the entire file. ESLint’s flat config system is now the modern configuration path for new projects [source: ESLint].
Where conflicts happen
Conflicts usually happen when ESLint is asked to enforce formatting rules. Examples include max line length, quote style, semicolons, indentation, and comma spacing. Prettier already controls those choices. If ESLint also checks them, the tools may fight.
Honestly, it feels like a bad joke when a developer runs Prettier, watches the file change, then sees ESLint complain about the fresh output. The fix is not to pick one tool. The fix is to remove format rules from ESLint.
The usual solution is:
- Use
prettierto format files. - Use
eslintto catch code issues. - Use
eslint-config-prettierto turn off ESLint rules that clash with Prettier.
This setup keeps responsibilities clean. Prettier becomes the formatter. ESLint becomes the reviewer for risky code.
Recommended setup for most JavaScript projects
Most teams should start with a simple setup before adding extra rules. A good baseline looks like this:
- Install Prettier for formatting.
- Install ESLint for code quality checks.
- Add eslint-config-prettier to disable conflicting style rules.
- Format on save in the editor.
- Run ESLint in CI before merges.
- Use pre-commit hooks for staged files if the team wants faster feedback.
A common workflow is:
- A developer writes JavaScript or TypeScript.
- The editor runs Prettier on save.
- ESLint highlights real code issues.
- A pre-commit hook formats and lints staged files.
- CI blocks code that still fails linting or formatting checks.
This approach keeps pull requests cleaner. Reviewers can focus on logic, naming, architecture, and edge cases. They do not need to comment on spacing or quote style.
When should a team use only one?
A team can use only Prettier for tiny scripts, demos, or throwaway prototypes. If the code will not be maintained, full linting may be overkill.
A team can use only ESLint if it has a strict custom style system and does not want Prettier’s opinions. That case is less common now. It also tends to create more config work.
For production apps, shared libraries, design systems, Node services, and long-term frontend projects, using both is usually the better choice. The tools cover different risks.
Best practices for using Prettier and ESLint together
- Do not duplicate formatting rules. Let Prettier own formatting.
- Keep ESLint focused. Rules should catch bugs, bad patterns, and project-specific issues.
- Make scripts clear. Use commands such as
format,format:check,lint, andlint:fix. - Run checks in CI. Local editor settings are helpful, but CI is the safety net.
- Document the setup. New developers should not need to guess which command to run.
FAQ
Is Prettier better than ESLint?
No. Prettier and ESLint do different jobs. Prettier is better for formatting. ESLint is better for finding risky code patterns and enforcing quality rules.
Can ESLint format code like Prettier?
ESLint can fix some style issues, but it should not be the main formatter in most projects. Prettier is more consistent and built for full-file formatting.
Should Prettier run before ESLint?
In many workflows, Prettier runs first, then ESLint checks the formatted code. In editors, Prettier can run on save while ESLint shows warnings in real time.
What package prevents Prettier and ESLint conflicts?
eslint-config-prettier is commonly used to disable ESLint rules that conflict with Prettier formatting.
Should TypeScript teams use both tools?
Yes. TypeScript teams often use Prettier, ESLint, and TypeScript ESLint together. Prettier formats the code, while ESLint adds rules that TypeScript alone may not enforce.
What is the final recommendation?
Most JavaScript developers should use both. Prettier should handle appearance. ESLint should handle quality. Together, they reduce review noise and catch more problems before release.