Fix Svelte class sorting with prettier-plugin-svelte v4#462
Conversation
|
For context, here's the |
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.
|
@leaysgur I didn't touch the changelog in this PR; was that necessary? Apologies for missing that if so! |
|
New user here... took a while to discover this issue and that it "wasn't me" :-) From what I understand so far, this functionality is the sole purpose of this plugin - so it's quite broken at the moment. Any idea when this fix will be published? Thanks! |
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.