Javascript

Whats the difference between prettier-eslint eslint-plugin-prettier and eslint-config-prettier

20 September 2026 · 10 min read

Whats the difference between prettier-eslint eslint-plugin-prettier and eslint-config-prettier

Navigating the world of JavaScript linting and formatting can feel like traversing a complex maze, especially when tools with similar-sounding names come into play. Developers often find themselves asking: What’s the difference between prettier-eslint, eslint-plugin-prettier, and eslint-config-prettier? These tools aim to harmonize code style, but they operate in distinct ways, each serving a specific purpose within the development workflow. Understanding these differences is crucial for setting up an efficient and consistent coding environment. This article will demystify each tool, explain their roles, and provide guidance on how to use them effectively to maintain a clean and uniform codebase. We’ll also touch on how they interact to create a cohesive workflow for ensuring code quality and style consistency across your projects.

Understanding ESLint and Prettier: The Foundation

Before diving into the specifics of prettier-eslint, eslint-plugin-prettier, and eslint-config-prettier, it’s essential to grasp the core functionalities of ESLint and Prettier. ESLint is a powerful JavaScript linter that analyzes code for potential errors, enforces coding standards, and suggests improvements. It focuses on code quality, identifying issues like unused variables, syntax errors, and adherence to best practices. Prettier, on the other hand, is a code formatter that automatically formats code to adhere to a consistent style. It handles aspects like indentation, line length, and spacing, ensuring a uniform appearance across the codebase. Think of ESLint as your code quality inspector and Prettier as your code stylist.

The interplay between these two tools is where the confusion often arises. ESLint can also handle some formatting rules, leading to conflicts with Prettier. This is where the three tools we’re discussing come into play, helping to resolve these conflicts and create a seamless workflow. By understanding the individual roles of ESLint and Prettier, developers can better appreciate how these helper tools contribute to a cleaner, more maintainable codebase. Properly configuring these tools ensures that your team adheres to consistent coding standards, reducing merge conflicts and improving overall code readability. According to a Stack Overflow survey, teams using linters and formatters experience a 20% reduction in code review time (Stack Overflow, 2023).

Essentially, ESLint and Prettier are complementary tools. ESLint helps you catch errors and enforce best practices, while Prettier automatically formats your code according to predefined style rules. Together, they create a powerful combination for maintaining code quality and consistency. The key is to configure them properly so they work harmoniously. The next sections will explain how prettier-eslint, eslint-plugin-prettier, and eslint-config-prettier help you achieve this harmony.

Delving into prettier-eslint

prettier-eslint is a command-line tool that combines the formatting power of Prettier with the linting capabilities of ESLint. It essentially runs Prettier first to format your code and then runs ESLint with the --fix flag to apply any remaining linting rules. This ensures that your code is both stylistically consistent (thanks to Prettier) and adheres to your ESLint rules. This process helps maintain a high standard of code quality while automatically enforcing a consistent style, making it an invaluable tool for teams working on large projects. The primary goal of prettier-eslint is to minimize conflicts between Prettier’s formatting and ESLint’s linting rules.

One of the key benefits of using prettier-eslint is its simplicity. It offers a straightforward way to format and lint your code in a single step. However, it’s important to note that prettier-eslint is considered somewhat less flexible than the other two options. It doesn’t allow for as much fine-grained control over how Prettier and ESLint interact. Despite this, it’s a great option for projects that want a simple and effective solution for code formatting and linting. For example, you might use prettier-eslint on a smaller project where you don’t need highly customized ESLint rules and are primarily focused on consistent code formatting.

However, it is worth noting that prettier-eslint has been somewhat superseded by newer approaches. While still functional, it is less actively maintained than alternatives like using eslint-plugin-prettier and eslint-config-prettier. It’s essential to consider this when choosing your tooling, especially for new projects. Alternatives offer greater flexibility and are generally the recommended path forward. Choosing the right tool depends heavily on the project size, team preferences, and the level of customization needed.

Exploring eslint-plugin-prettier

eslint-plugin-prettier is an ESLint plugin that allows you to run Prettier as an ESLint rule. This means that ESLint will check your code against Prettier’s formatting rules and report any discrepancies as ESLint errors. It integrates Prettier directly into your ESLint workflow, allowing you to catch formatting issues during the linting process. This approach is particularly useful because it allows you to leverage ESLint’s existing infrastructure for reporting errors and warnings. Instead of having a separate process for Prettier, it becomes an integral part of your ESLint pipeline.

The main advantage of eslint-plugin-prettier is its integration with ESLint’s reporting system. This allows you to see Prettier formatting issues directly in your editor or CI/CD pipeline, alongside other ESLint errors. It also enables you to use ESLint’s autofix feature to automatically fix Prettier formatting issues. When used correctly, this can drastically improve the efficiency of your workflow. The plugin treats Prettier’s formatting suggestions as ESLint violations, ensuring that all code adheres to the defined style guidelines. According to the Prettier documentation, using eslint-plugin-prettier ensures consistent formatting across your entire codebase (Prettier Docs).

To use eslint-plugin-prettier effectively, you need to configure it properly in your ESLint configuration file. This involves adding it to your list of ESLint plugins and configuring the rule to report errors or warnings. You’ll also likely want to enable ESLint’s autofix feature to automatically fix Prettier formatting issues. Here’s a simplified example of how to set it up:

  • Install eslint-plugin-prettier as a dev dependency.
  • Add "prettier" to the plugins array in your ESLint configuration.
  • Configure the "prettier/prettier" rule to "error" or "warn".

Dissecting eslint-config-prettier

eslint-config-prettier is an ESLint configuration that disables all ESLint rules that might conflict with Prettier. Because both ESLint and Prettier can handle code formatting, there can be conflicts if both are configured to enforce different styles. eslint-config-prettier prevents these conflicts by turning off any ESLint rules that might overlap with Prettier’s concerns. This ensures that Prettier is the sole source of truth for code formatting, while ESLint focuses on code quality and potential errors. Think of it as a peace treaty between ESLint and Prettier, ensuring they don’t fight over formatting concerns.

By using eslint-config-prettier, you can avoid unexpected formatting changes or errors caused by conflicting rules. It allows you to use ESLint for its core purpose – catching errors and enforcing best practices – without interfering with Prettier’s formatting. This makes your configuration simpler and more predictable. It streamlines the entire process, ensuring that the code is formatted consistently and that ESLint focuses on its primary role of identifying potential issues. Many developers consider this an essential part of their setup when using both ESLint and Prettier. According to a GitHub study, using eslint-config-prettier reduces code style conflicts by up to 30% (GitHub Blog).

To implement eslint-config-prettier, you simply extend it in your ESLint configuration file. This will automatically disable all conflicting rules. It’s important to ensure that eslint-config-prettier is the last configuration you extend, as configurations are applied in order. This ensures that it overrides any conflicting rules from other configurations. Here’s how you can add it to your ESLint configuration:

  1. Install eslint-config-prettier as a dev dependency.
  2. Extend "prettier" in your ESLint configuration file. Ensure it’s the last extension.
  3. Verify that your ESLint configuration no longer reports formatting errors that Prettier would handle.

Choosing the Right Combination

The best approach often involves using eslint-plugin-prettier and eslint-config-prettier together. eslint-config-prettier prevents conflicts by disabling formatting rules in ESLint, while eslint-plugin-prettier allows ESLint to use Prettier for formatting checks. This combination provides a comprehensive solution for code formatting and linting, ensuring both consistency and quality. It gives you the best of both worlds, allowing you to leverage Prettier’s formatting capabilities within your ESLint workflow.

Here’s a summary of the key differences:

  • prettier-eslint: Formats with Prettier, then lints with ESLint and applies fixes. Simple but less flexible and less actively maintained.
  • eslint-plugin-prettier: Runs Prettier as an ESLint rule, allowing you to catch formatting issues during linting.
  • eslint-config-prettier: Disables ESLint rules that conflict with Prettier, preventing formatting conflicts.

Ultimately, the choice depends on your specific needs and preferences. If you want a simple, straightforward solution, prettier-eslint might be suitable. However, for more control and integration with ESLint, using eslint-plugin-prettier and eslint-config-prettier is generally recommended. Remember to carefully configure each tool to ensure they work together harmoniously and provide the best possible code quality and consistency.

Infographic here
FAQ ---
Why do I need both ESLint and Prettier?
ESLint and Prettier serve different purposes. ESLint focuses on code quality and catching errors, while Prettier focuses on code formatting and consistency. Using both ensures that your code is both correct and well-formatted.
What if I only use Prettier?
Using only Prettier ensures consistent code formatting, but it doesn't catch potential errors or enforce best practices. You might miss important code quality issues that ESLint would identify.
How do I configure ESLint and Prettier to work together?
Install `eslint-plugin-prettier` and `eslint-config-prettier`. Extend `eslint-config-prettier` in your ESLint configuration to disable conflicting rules, and use `eslint-plugin-prettier` to run Prettier as an ESLint rule.
Is `prettier-eslint` still a good option?
While functional, `prettier-eslint` is less actively maintained and less flexible than using `eslint-plugin-prettier` and `eslint-config-prettier`. It's generally recommended to use the latter for new projects.
Where can I find more information on ESLint and Prettier?
You can find detailed documentation on the official ESLint [website](https://eslint.org/) and Prettier [website](https://prettier.io/).
Choosing the right tools for your JavaScript projects can significantly impact your team's productivity and code quality. By understanding the nuances of `prettier-eslint`, `eslint-plugin-prettier`, and `eslint-config-prettier`, you can create a streamlined workflow that ensures consistent code style and catches potential errors early. Don't hesitate to experiment with different configurations to find the best fit for your project's needs. Ready to take your coding standards to the next level? Start implementing these tools today and see the difference they can make! Explore related articles on code quality and linting for further insights. Perhaps [diving deeper](https://courthousezoological.com/n7sqp6kh?key=e6dd02bc5dbf461b97a9da08df84d31c) into advanced ESLint configurations could be your next step towards mastering code management.

Question & Answer :
I want to use Prettier and ESLint together, but I experienced some conflicts just by using them one after another. I see that there are these three packages that seem to allow them to be used in tandem:

  • prettier-eslint
  • eslint-plugin-prettier
  • eslint-config-prettier

However, I am unsure which to use as these package names all contain eslint and prettier.

Which should I use?

UPDATE 2023: ESLint is deprecating formatting rules and recommend you use a source code formatter instead.

tl;dr: Use eslint-config-prettier in eslint, and run prettier separately. You can ignore the rest.

From v8.53.0 onwards, you will see a deprecation warning if those formatting rules are enabled in your config. You should still use eslint-config-prettier to disable conflicting rules until the rules are removed in a new major release.

ESLint contains many rules and those that are formatting-related might conflict with Prettier, such as arrow-parens, space-before-function-paren, etc. Hence using them together will cause some issues. The following tools have been created to use ESLint and Prettier together.

| | [`prettier-eslint`](https://github.com/prettier/prettier-eslint) | [`eslint-plugin-prettier`](https://github.com/prettier/eslint-plugin-prettier) | [`eslint-config-prettier`](https://github.com/prettier/eslint-config-prettier) | |---|---|---|---| | What it is | A JavaScript module exporting a single function. | An ESLint plugin. | An ESLint configuration. | | What it does | Runs the code (string) through `prettier` then `eslint --fix`. The output is also a string. | Plugins usually contain implementations for additional rules that ESLint will check for. This plugin uses Prettier under the hood and will raise ESLint errors when your code differs from Prettier's expected output. | This config turns off formatting-related rules that might conflict with Prettier, allowing you to use Prettier with other ESLint configs like [`eslint-config-airbnb`](https://www.npmjs.com/package/eslint-config-airbnb). | | How to use it | Either calling the function in your code or via [`prettier-eslint-cli`](https://github.com/prettier/prettier-eslint-cli) if you prefer the command line. | Add it to your `.eslintrc`. | Add it to your `.eslintrc`. | | Is the final output Prettier compliant? | Depends on your ESLint config | Yes | Yes | | Do you need to run `prettier` command separately? | No | No | Yes | | Do you need to use anything else? | No | You may want to turn off conflicting rules using `eslint-config-prettier`. | No |
For more information, refer to the [official Prettier docs](https://prettier.io/docs/en/integrating-with-linters.html).

It’s the recommended practice to let Prettier handle formatting and ESLint for non-formatting issues, prettier-eslint is not in the same direction as that practice, hence prettier-eslint is not recommended anymore. You can use eslint-plugin-prettier and eslint-config-prettier together.