-
Notifications
You must be signed in to change notification settings - Fork 138
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
VS Code format on save fights with prettier format (while linting) #244
Comments
Hi! It looks like I have the same problem. I use the following script to fix it before committing: However, if I edit the file with a problem, prettier-plugin-tailwindcss changes the order again |
Thanks for chipping in @YuliyaMinsk This problem gets messy once a project grows, and you have like 20k+ lines of code. It causes a never ending loop of commits. In my case, in some projects like the above, we have disabled the plugin |
@konradbjk can you provide a reproduction? Also, I see you're using Yarn 4 — and it's likely that you're using PnP. It's quite possible this is the source of the problem (given that it often requires specialized support from any tooling used) and disabling PnP could fix it. Add this to your
|
Could you please tell me how I can create a sandbox for reproduction? I have PnP off. Though, if just having PnP is an issue, then you have either way a bug here |
@konradbjk just a git repo I can clone on GitHub is fine. |
Closing this issue as it's been sitting open for a while without a reply. If you can provide a reproduction i'll take a look. Thanks! |
@thecrypticace I ran into this issue a few weeks ago too and had to disable the plugin. Can you reopen it for now? I'll try and get a repro. |
@thecrypticace I've got a repro here https://github.com/nerdyman/prettier-plugin-tailwindcss-vscode-conflict It seems to occur when the Tailwind config is changed without reloading VS Code. Kapture.2024-04-11.at.12.46.44.mp4In the example above Prettier is watching and writing files from the command line and fighting with the Prettier plugin in VS Code over the order when the file is saved. VS Code formats things consistently after it has been reloaded. I'm not sure if this is a full repro as I don't recall changing the Tailwind config when I encountered this issue a few weeks ago but hopefully it will help somewhat. It might relate to #262 at least. |
This comment was marked as spam.
This comment was marked as spam.
Has this issue been resolved? I still have the same problem. |
EDIT: After some more troubleshooting it was my own fault. I had a plugin called headwind installed which conflicted with the prettier sorting. |
Same problem here, had to disable the plugin. [email protected] + [email protected] |
Glad I found this thread - I'm experiencing this same problem and was able to resolve it by |
What version of
prettier-plugin-tailwindcss
are you using?v0.5.11
What version of Tailwind CSS are you using?
3.4.1
What version of Node.js are you using?
20.11.0
What package manager are you using?
yarn 4.1.0
What operating system are you using?
macOs
Describe your issue
I have a weird issue with VS Code. I have configured in the
.vscode/settings.json
And correctly added plugin. It generally works. While I save, the classes gets reordered. What is more, VS Code underlines with red, if the classes are not properly sorted
However, when I run a build on my code, while lining it raises issues from prettier, that the tailwindcss classes are incorrectly sorted.
Sample
When prettier "fixes" the classes, I end up with VS Cody showing me errors, that the classes are not correctly sorted.
My
package.json
Has anyone seen similar issues? Ideally have a fix?
The text was updated successfully, but these errors were encountered: