configurationjetbrains-ideprettierriderformatter

How to edit prettier config file to match JedBrain`s Rider inbuilt formatter configuration?


Use Case

In Our working environment there are developers who are using different IDEs to develop the codebase, some folks might use VSC some other use Rider, etc.


The objective

Each of these IDE has its own inbuilt formatter which are not the same. This naturally lead to unnecessary conflicts during rebase/merge. So, It was decided that we are going to use an extension, Prettier to have a common formatter. Prettier can be configured and thus everyone would have the same formatting no mater of what IDE they use.


Solution (?)

It was decided that most of the formatting needs to be similar to what Rider has to offer, therefore, one needs to create a new .prettierrc (i.e. a prettier configuration file) file which matches the format that Rider already offers.

And this leads us to the original question: How to edit prettier config file to match JetBrains's Rider inbuilt formatter configuration?

I wonder if anyone has done this already, perhaps share the config file.

Thanks for taking the time for reading this question 🙏.


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 Rider formatter that has dozens of code style settings.

    I'd suggest using Prettier as a formatter for your code in all IDEs, it can be set up as a default formatter for JetBrains IDEs.