Fix Svelte class sorting with prettier-plugin-svelte v4#462
Merged
Boshen merged 2 commits intoMay 25, 2026
Merged
Conversation
Contributor
Author
|
For context, here's the |
1 task
leaysgur
approved these changes
May 25, 2026
Contributor
leaysgur
left a comment
There was a problem hiding this comment.
The changes look good.
As for the code, while backward compatibility with previous Svelte versions is maintained, it's a bit concerning that we haven't verified this through tests or CI.
For now, I've confirmed that the tests still pass with prettier-plugin-svelte@3.5.2.
Contributor
Author
|
@leaysgur I didn't touch the changelog in this PR; was that necessary? Apologies for missing that if so! |
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
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.
Fixes Svelte class sorting with
prettier-plugin-svelte@4.The recently released version 4 of
prettier-plugin-sveltenow parses with the modern Svelte AST. That changed the template shape from the legacyhtml.children/MustacheTagstructure tofragment.nodes/ExpressionTag, so the Svelte transformer was no longer reaching markup class attributes or dynamicclass={...}expressions. This PR updates the Svelte traversal to handle both AST shapes, while preserving the existing legacy path. It also updates the Svelte plugin test dependency to v4 so this regression is covered.