TailwindCSS classes sorting with prettier-plugin-tailwindcss doesn’t work.
I feel it stopped around the latest issues with prettier.
Prettier extension (12.3.0) seems to be back to normal in Cursor 2.4.21.
But the prettier-plugin-tailwindcss doesn’t work. I tried with 0.6.12 and 0.7.2.
Testing the same setup in VSCode and it works as expected.
Steps to Reproduce
Cursor 2.4.21
Extension: Prettier 12.3.0
prettier-plugin-tailwindcss installed. latest version 0.7.2 plugins: ['prettier-plugin-tailwindcss'], added in prettier.config.js
Try with something like <div className="text-white flex mt-2 px-4 ">Test </div>
Auto format on save
cmd+s
Expected Behavior
It should auto format and sort classes to <div className="mt-2 flex px-4 text-white">Test </div>
Hey, thanks for the report. It looks like this is related to the current Prettier issues in version 2.4.x.
A few things to check:
Does normal Prettier formatting work without the tailwindcss plugin? Try temporarily removing the plugins line from your prettier.config.js and see if format-on-save works.
Can you check the Prettier output for errors? Go to View > Output, then select “Prettier” in the dropdown. Do you see any errors there?
As a temporary workaround, try rolling back the Prettier extension to v11.0.2 (Extensions > Prettier > Install Specific Version). Some users reported this fixes plugin issues while we work on a full fix.
Yes, it seems related to the recent prettier issues. I don’t know for sure, but I noticed prettier-plugin-tailwindcss stopped working around the same time as Prettier in general (~early last week).
Regarding your Qs:
1/ normal prettier formatting works now.
2/ Yes I checked that. No errors. It lists the plugin but the plugin doesn’t seem to work.
3/ Reg downgrading to Prettier 11.0.2 - yes I checked that. I was using this workaround when Prettier was not working at all to have at least the basic formatting. Unfortunately prettier-plugin-tailwindcss doesn’t work at 11.0.2 nor the newest 12.3.0
Exactly same setup works in VSCode.
I noticed this issue in a larger monorepo, but just checked in a simple single nextjs project and also no luck.