-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sort class lists deterministically for Prettier plugin #10672
Conversation
5d22c17
to
e44eafa
Compare
This change results in a lot of churn on my site, and in particular it changes the order of margins. Before margins were trlb but now they aren't. Are we sure this didn't have a bug? |
@carlmjohnson So yeah, this is intended behavior, although you're totally right it does result in a bunch of new classes being sorted by our Prettier plugin that previously weren't. I actually just tweeted about this yesterday: https://twitter.com/reinink/status/1641222722179985408 When we added deterministic sorting to Tailwind CSS back in January (see #10382) we forgot to update the Prettier plugin to match this, so in v3.3 we've corrected this (#10672). My recommendation is to run Prettier against your whole project to make all these changes at once. I'm a fan of this change personally the Prettier plugin sorting is even more thorough now — meaning even less for us developers to have to think about 👍 |
refs #676 - required for the `eslint-plugin-tailwindcss` bump to work correctly - ran `yarn lint:js --fix` - CSS ordering changed to be more deterministic, see tailwindlabs/tailwindcss#10672
refs #676 - required for the `eslint-plugin-tailwindcss` bump to work correctly - ran `yarn lint:js --fix` - CSS ordering changed to be more deterministic, see tailwindlabs/tailwindcss#10672
refs #676 - required for the `eslint-plugin-tailwindcss` bump to work correctly - ran `yarn lint:js --fix` - CSS ordering changed to be more deterministic, see tailwindlabs/tailwindcss#10672
Something we noticed in testing. With the latest release we made sure to sort generated rules deterministically rather than based on content-scanning order which can (and does) differ across environments. However, in testing, we noticed that the Prettier plugin didn't take this into account when ordering class names.
This PR enables that behavior in the API used by our prettier plugin so the next release of Tailwind will ensure prettier sorts the classes correctly.