prettier-plugin-tailwind icon indicating copy to clipboard operation
prettier-plugin-tailwind copied to clipboard

prettier-plugin-tailwind conflicts with other typescript plugins

Open hrougier opened this issue 4 years ago • 4 comments

Describe the bug

I was using prettier-plugin-organize-imports in my project. After installing prettier-plugin-tailwind, prettier-plugin-organize-imports stopped working.

This is due to the fact that both plugins are redefining the typescript parser in their configuration, both importing prettier/parser-typescript to inherit from it.

prettier-plugin-organize-imports uses the preprocess property of the parser while prettier-plugin-tailwind uses the parse property, but the last plugin loaded by prettier completely overrides any previous one.

To Reproduce Steps to reproduce the behavior:

  1. install prettier-plugin-organize-imports, it works.
  2. install prettier-plugin-tailwind, it works but 1. not longer works.

Expected behavior

Does anyone know if it is possible to have both plugin working together (something like merging their parser configuration together)?

Versions:

  • prettier-plugin-tailwind version: 2.2.8
  • prettier-plugin-organize-imports version: 1.1.1

hrougier avatar Feb 06 '21 17:02 hrougier

For information,

This was discussed here #10259. Looks like there is a way to achieve it in #8195.

There is also a discussion for a dedicated API in #4424 to make it easier.

hrougier avatar Feb 06 '21 22:02 hrougier

@hrougier Thank you for opening this. Unfortunately prettier has lack of support for the kind of plugins like this one and prettier-plugin-organize-imports.

I looked into this issue when writing this plugin but it seems like for now we have to wait for prettier to add better support for these cases - unless someone finds a good approach to fix this, in which case a PR would be really appreciated.

tqwewe avatar Feb 24 '21 09:02 tqwewe

any update on this?

jlorezz avatar May 01 '22 06:05 jlorezz

@florianbress no updates, I suggest you use the official tailwind plugin as that's more up to date

tqwewe avatar May 12 '22 11:05 tqwewe