-
-
Notifications
You must be signed in to change notification settings - Fork 172
fix: prevent Svelte files from breaking when there are duplicate classes #359
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
Merged
thecrypticace
merged 6 commits into
tailwindlabs:main
from
dsantolo:fix/svelte-duplicate-nobreak
May 30, 2025
Merged
fix: prevent Svelte files from breaking when there are duplicate classes #359
thecrypticace
merged 6 commits into
tailwindlabs:main
from
dsantolo:fix/svelte-duplicate-nobreak
May 30, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I can clearly see where I thought I'd done this already but… didn't 🤦♂️ Thanks for the fix! It should be available via the insiders build in a few minutes:
I'll likely get a tagged release out next week. |
Nick2bad4u
added a commit
to Nick2bad4u/UserStyles
that referenced
this pull request
Sep 2, 2025
 <h3>Snyk has created this PR to upgrade prettier-plugin-tailwindcss from 0.6.13 to 0.6.14.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **1 version** ahead of your current version. - The recommended version was released **23 days ago**. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>prettier-plugin-tailwindcss</b></summary> <ul> <li> <b>0.6.14</b> - <a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/releases/tag/v0.6.14">2025-07-09</a></br><ul> <li>Add support for OXC + Hermes Prettier plugins (<a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/376" data-hovercard-type="pull_request" data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/376/hovercard">#376</a>, <a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/380" data-hovercard-type="pull_request" data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/380/hovercard">#380</a>)</li> <li>Sort template literals in Angular expressions (<a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/377" data-hovercard-type="pull_request" data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/377/hovercard">#377</a>)</li> <li>Don't repeatedly add backslashes to escape sequences when formatting (<a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/381" data-hovercard-type="pull_request" data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/381/hovercard">#381</a>)</li> </ul> </li> <li> <b>0.6.13</b> - <a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/releases/tag/v0.6.13">2025-06-19</a></br><ul> <li>Prevent Svelte files from breaking when there are duplicate classes (<a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/359" data-hovercard-type="pull_request" data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/359/hovercard">#359</a>)</li> <li>Ensure <code>prettier-plugin-multiline-arrays</code> and <code>prettier-plugin-jsdoc</code> work when used together with this plugin (<a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/372" data-hovercard-type="pull_request" data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/372/hovercard">#372</a>)</li> </ul> </li> </ul> from <a href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/releases">prettier-plugin-tailwindcss GitHub release notes</a> </details> </details> --- > [!IMPORTANT] > > - Check the changes in this PR to ensure they won't cause issues with your project. > - This PR was automatically created by Snyk using the credentials of a real user. --- **Note:** _You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs._ **For more information:** <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIyZTI4NzFkYS0zYjg3LTRiODMtYTRjMC1hNWJjMjU0OGE5NzEiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjJlMjg3MWRhLTNiODctNGI4My1hNGMwLWE1YmMyNTQ4YTk3MSJ9fQ==" width="0" height="0"/> > - 🧐 [View latest project report](https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 📜 [Customise PR templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template) > - 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88/settings/integration?pkg=prettier-plugin-tailwindcss&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) [//]: # 'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"prettier-plugin-tailwindcss","from":"0.6.13","to":"0.6.14"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"2e2871da-3b87-4b83-a4c0-a5bc2548a971","prPublicId":"2e2871da-3b87-4b83-a4c0-a5bc2548a971","packageManager":"npm","priorityScoreList":[],"projectPublicId":"fbcde33d-0af3-42e5-87f7-b8fdd4c91c88","projectUrl":"https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-07-09T19:09:50.420Z"},"vulns":[]}'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As of v0.6.11, Svelte files still break after saving a file that contains duplicate classes in template strings (related to #303).
This seems to be because of a bug where there are certain times
transformSvelte
results in calls tosortClasses
that don't passremoveDuplicates
at all, butsortClasses
defaults it to true, resulting in the plugin attempting to remove duplicates even though this is not supported yet in Svelte.Now, we pass
removeDuplicates
in all cases. In the case of string literals, this results in the classes being sorted with the duplicates remaining (without breaking your project). Getting the functionality of removing duplicates removed in string literals requires more work.However, it seems that removing duplicates in the normal "text" (non-literal) case works totally fine in Svelte, so I decided to enable removing duplicates in that case. Added some new tests with duplicates in the 3 different cases that all pass.
Before
Thanks to @onsclom for helping on this!