Skip to content
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

Sorting of extended values does not work properly #262

Closed
dmitrystas opened this issue Apr 9, 2024 · 6 comments
Closed

Sorting of extended values does not work properly #262

dmitrystas opened this issue Apr 9, 2024 · 6 comments
Labels
question Further information is requested

Comments

@dmitrystas
Copy link

What version of prettier-plugin-tailwindcss are you using?

Latest

What version of Tailwind CSS are you using?

Latest

What version of Node.js are you using?

Latest

What package manager are you using?

pnpm

What operating system are you using?

Ubuntu

Describe your issue

Sorting of some (I've found spacing and fontSize, but maybe there are some others) extended values is broken. For example, here is the result of standard 14 spacing sorting:

class="fixed flex p-14"

Looks good. But if we try to sort some non-standard value, like

export default {
  extend: {
    spacing: {
      15: '3.75rem'
    }
  }
}

we get

class="p-15 fixed flex"

i.e. p-15 is at the beginning.

At first I thought this was true for all non-standard values. But this is not the case, for example, sorting of z-index

export default {
  extend: {
    zIndex: {
      1: '1'
    }
  }
}

works correctly and after sorting z-1 is not at the beginning

class="fixed z-1 flex"

@adamwathan
Copy link
Member

Weird one! Here's a minimal reproduction for when we get a chance to look into this:

https://play.tailwindcss.com/1CAwzxiiNJ

@dmitrystas
Copy link
Author

Hmm, it looks like the incorrect behavior is only true for VSCode... In the console
prettier --write ...
works pretty good...

@thecrypticace
Copy link
Contributor

Weird one! Here's a minimal reproduction for when we get a chance to look into this:

https://play.tailwindcss.com/1CAwzxiiNJ

If you hit tidy or cmd-s it sorts correctly.

@thecrypticace
Copy link
Contributor

I saw you're using pnpm — chances are it might be the VSCode prettier extension that's the cause because it can't find your config.

Can you share a reproduction repo?

@thecrypticace thecrypticace added the question Further information is requested label Apr 10, 2024
@dmitrystas
Copy link
Author

Jordan, I'm really sorry that you wasted your time on me :( I've updated all my project/VSCode dependencies to the latest versions, and now both VSCode sorting as well as CLI sorting work perfect. I apologize again and thank you!

@thecrypticace
Copy link
Contributor

@dmitrystas No worries at all! And hey, we ended up finding (and fixing) a bug in Play because of it. Though the fix isn't live yet — got a few other things we're working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants