prettier-plugin-sort-imports icon indicating copy to clipboard operation
prettier-plugin-sort-imports copied to clipboard

Incompatibility with `prettier-plugin-organize-attributes`

Open mcelligottnick opened this issue 11 months ago • 3 comments

Your Environment

  • Prettier version: 3.4.2
  • node version: v23.6.1.
  • package manager: [email protected]
  • IDE: VScode

Describe the bug

When prettier-plugin-organize-attributes is included in the plugins, only one will work (which ever is first in the array).

To Reproduce

Install and add prettier-plugin-organize-attributes plugin to your confirg and try and format import order and attribute order. Only one will format.

Expected behavior

Both import order and attribute order.

mcelligottnick avatar Jan 24 '25 06:01 mcelligottnick

Hi, thanks for the report. There are certain types of prettier plugins that do not work well together, those which "preprocess" files and modify the AST, which this plugin does. prettier-plugin-organize-attributes likely does the same thing. There's not a lot we can do until Prettier modifies the plugin system to allow these kinds of plugins to work correctly with each other.

That said, there are other plugins, like tailwind's prettier plugin, which manually add compatibility for others like ours. Theoretically, we could do something similar, to add support for prettier-plugin-organize-attributes. It isn't terribly straightforward, however, and I don't have time to work on that at the moment. But I'll leave this issue open, and if anyone is interested in taking a shot at it, let me know and we can talk it through.

IanVS avatar Jan 24 '25 12:01 IanVS

Yeah I have read from some other plugins about that kind of incompatability. Thanks for the info, I wish I knew more about this kind of programming to be able to help.

mcelligottnick avatar Jan 25 '25 01:01 mcelligottnick

More info and potential fix in this thread

mkanavakatini avatar May 16 '25 14:05 mkanavakatini