ESLint and Prettier serve distinct but complementary roles in modern JavaScript/TypeScript development.
ESLint is a static code analysis tool focused on code quality, bug detection, and enforcing coding standards. It identifies issues like unused variables, incorrect syntax, logical errors, and potential bugs. It can also automatically fix some problems and is highly configurable with a vast ecosystem of plugins and rules.
Prettier is an opinionated code formatter that ensures consistent code style across your codebase. It parses code and completely rewrites it according to its own formatting rules (e.g., indentation, line breaks, spacing), eliminating debates over formatting preferences. It supports multiple languages (JavaScript, TypeScript, CSS, HTML, JSON, etc.) and has minimal configuration options.
Key Differences
| Feature | ESLint | Prettier |
| Primary Focus | Code quality, logic, bug prevention | Code formatting, style consistency |
| Automatically Formats | Partially (only fixable issues) | Yes (rewrites entire code) |
| Configuration | Highly customizable, complex | Minimal, opinionated |
| Error Detection | Yes (bugs, bad practices) | No |
| Performance | Slower (due to analysis) | Faster (focused on formatting) |
| Use Case | Catching errors, enforcing best practices | Ensuring consistent code appearance |
Why Use Both?
While ESLint can format code, Prettier generally does it better and faster. Using both together is a best practice:
Prettier handles all formatting concerns.
ESLint handles logic, bugs, and non-formatting style rules.
To avoid conflicts, disable formatting rules in ESLint when using Prettier (e.g., via
eslint-plugin-prettieror by excluding formatting rules).
✅ Bottom Line: Use Prettier for formatting and ESLint for linting. They are not competitors — they are teammates.
Why use prettier if ESLint can format?
What is the difference between Prettier, StandardJS and ESLint?
Eslint, Prettier and coc.nvim
Give ALE a try. I use it for eslint and rubocop and it works great.
More on reddit.comDo you use eslint and/or prettier?
What is ESLint used for?
What is the difference between linting and Prettier?
Videos
I've heard ESLint can format but I haven't found a clear answer why it seems prettier is used instead of the ESLint formatter. Whenever I try to look it up most comments neglect to mention that ESLint can also format so it's not obvious why prettier would be needed at all.