Search code examples
intellij-ideacoding-styleprettier

Prettier config for intellij settings


On one of our frontend (react) repos we have code written for the past 2 years styled with default IntelliJ code-settings We would like to start using Prettier and not be coupled with 1 IDE, we see 2 options:

  1. Run prettier on all legacy code and configure IntelliJ with prettier for code-style
  2. Configure prettier to the same settings IntelliJ has as default

We would prefer to go with option #2 since we want to keep a clean git history, any suggestions on how to configure Prettier with IntelliJ settings, and if that sounds like the right thing to do as Prettier is opinionated about some code-styles.


Solution

  • Prettier is opinionated formatter with a very limited set of configuration options, and its team is not going to accept any requests for adding new options, see https://prettier.io/docs/en/option-philosophy.html. So Prettier can hardly be configured to produce the same output as IDEA formatter.

    I'd suggest using Prettier as a formatter for your code, it can be set up as a default formatter for IDEA