question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] Sorting classes does not work the same way as Tailwind's sort order

See original GitHub issue

Describe the bug The docs for this plugin state that it uses “order process from the official prettier-plugin-tailwindcss”. However, while trying this plugin out for the first time today, most of the examples given on that page are not sorted the same way using this plugin:


Tailwind docs: image

Actual Results: <div class="flex h-24 p-3 ml-4 text-gray-700 border-2 border-gray-300 shadow-md"></div>


Tailwind Docs: image

Actual Results: <div class="scale-125 opacity-50 hover:opacity-75 hover:scale-150"></div>


Tailwind Docs: image

Actual Results: <div class="grid grid-cols-2 lg:grid-cols-4 sm:grid-cols-3"></div>


Is my end somehow set up wrong? Or is this plugin not actually meant to use the tailwind class order?

My .eslint.rc config file:

{
	"plugins": ["tailwindcss"],
	"extends": ["plugin:tailwindcss/recommended"]
}

Expected behavior This plugin should be sorting classes in the same way listed in the Tailwind docs.

Environment (please complete the following information):

  • OS: MacOS
  • “eslint”: “^8.22.0”,
  • “eslint-plugin-tailwindcss”: “^3.6.0”,
  • VSCode 1.70.2

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:6
  • Comments:17 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
francoismassartcommented, Nov 10, 2022

@darylknight , @cmalard , @markflorkowski , @locona , @sawirricardo

Sorry for the long waiting period, I mostly work on this during my free time 😅

I just published a new beta version which should support Tailwind CSS up to 3.2.3 as well as fixed ordering for older Tailwind CSS version.

Could you try it out via:

  1. npm i -D eslint-plugin-tailwindcss@3.7.0-beta.0
  2. Test it on your own projects
  3. Share your feedback in the comments ?

MR: #176

Thank you for your feedback

Read more comments on GitHub >

github_iconTop Results From Across the Web

Incompatibility with other Prettier plugins · Issue #31 - GitHub
[BUG] All tailwind classes are marked as out-of-order ... But as this issue suggests, Tailwind classes are not sorted when run with this...
Read more >
Sorting Tailwind CSS Classes Automatically with Prettier
... you how to set up Prettier and the new Prettier plugin for Tailwind CSS, which will sort your classes automatically. One thing...
Read more >
Enable Automatic Tailwind Class Sorting in 4 Minutes
Luckily, the Tailwind team has an official solution. In this Larabit, let's enable automatic class sorting in four minutes.
Read more >
Automatic Class Sorting with Prettier - Tailwind CSS
The plugin will respect your tailwind.config.js file and work with any Tailwind plugins you've installed, but there is no way to change the...
Read more >
javascript - Tailwindcss not working with next.js; what is wrong ...
The same issue with my project, but I try to change the globals.css like this: before
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found