tqwewe / prettier-plugin-tailwind

Sort tailwind classes in HTML with Prettier.

Home Page:https://www.npmjs.com/package/prettier-plugin-tailwind

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

prettier-plugin-tailwind conflicts with other typescript plugins

hrougier opened this issue · 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

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 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.

any update on this?

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