tailwindlabs / prettier-plugin-tailwindcss

A Prettier plugin for Tailwind CSS that automatically sorts classes based on our recommended class order.
MIT License
5.67k stars 134 forks source link

Inconsistent formatting results when ran per file/per project #302

Closed rChaoz closed 4 months ago

rChaoz commented 4 months ago

The problem

I'm using WebStorm with the "run prettier on save" option. Now, I'm not exactly sure how it runs prettier, but the result differs from running prettier --write <path>. More specifically, my custom variants are sorted first when saving the file, and sorted last when running the command manually. This is a problem because the CI fails when I use the IDE formatting, so I need to format on every commit manually.

It doesn't call the CLI script, so I'm guessing it calls the format API directly, and it ends up not loading the tailwind.config.ts file like it should, but this is just my guess.

Versions and stuff

What version of prettier-plugin-tailwindcss are you using? v0.5.14

What version of Tailwind CSS are you using? v3.4.1

What version of Node.js are you using? 20.8.0

What package manager are you using? yarn 4.1.1

What operating system are you using? Windows

gregberge commented 4 months ago

Duplicate of #270

thecrypticace commented 4 months ago

Closing in favor of #270 — if you can provide an example project that would be fantastic.