What version of prettier-plugin-tailwindcss are you using? v0.8.0
What version of Tailwind CSS are you using? v4.3.2
What version of Node.js are you using? v24.18.0
What package manager are you using? npm
What operating system are you using? Ubuntu WSL
Reproduction URL
No reproduction URL, but TDD MR to come
Describe your issue
Description
The README's compatibility table lists @trivago/prettier-plugin-sort-imports (and others) as compatible, but that does not apply to .svelte files. Import sorting inside a .svelte file's <script> block is silently skipped, regardless of plugin order.
Root cause
svelte's defineTransform doesn't declare the compatible array configured in other transforms, which means Tailwind doesn't merge the parser wrappers from compatible plugins when used with Svelte. Any custom parse/preprocess logic provided by "compatible" plugins is lost, so import sorting never runs for .svelte files.
The html, css/scss/less transforms do declare their own compatible lists (prettier-plugin-organize-attributes, prettier-plugin-css-order respectively), so this looks like an oversight specific to the svelte transform rather than an intentional limitation.
Versions
prettier: 3.9.4
prettier-plugin-tailwindcss: 0.8.0
prettier-plugin-svelte: 3.5.2 (also reproduces on 4.1.1)
@trivago/prettier-plugin-sort-imports: 6.0.2
- Node: v24.18.0
Suggested fix
Add a compatible array to the svelte defineTransform call mirroring the one used for babel/typescript, e.g.:
defineTransform({
staticAttrs: ["class"],
+ compatible: ["@trivago/prettier-plugin-sort-imports"],
load: [{ name: "prettier-plugin-svelte", importer: () => import("prettier-plugin-svelte") }],
parsers: { svelte: {} },
...
})
NOTE: unless I'm mistaken, trivago's is the only plugin providing Svelte support.
What version of
prettier-plugin-tailwindcssare you using? v0.8.0What version of Tailwind CSS are you using? v4.3.2
What version of Node.js are you using? v24.18.0
What package manager are you using? npm
What operating system are you using? Ubuntu WSL
Reproduction URL
No reproduction URL, but TDD MR to come
Describe your issue
Description
The README's compatibility table lists
@trivago/prettier-plugin-sort-imports(and others) as compatible, but that does not apply to.sveltefiles. Import sorting inside a.sveltefile's<script>block is silently skipped, regardless of plugin order.Root cause
svelte's
defineTransformdoesn't declare thecompatiblearray configured in other transforms, which means Tailwind doesn't merge the parser wrappers from compatible plugins when used with Svelte. Any custom parse/preprocess logic provided by "compatible" plugins is lost, so import sorting never runs for .svelte files.The
html,css/scss/lesstransforms do declare their owncompatiblelists (prettier-plugin-organize-attributes,prettier-plugin-css-orderrespectively), so this looks like an oversight specific to thesveltetransform rather than an intentional limitation.Versions
prettier: 3.9.4prettier-plugin-tailwindcss: 0.8.0prettier-plugin-svelte: 3.5.2 (also reproduces on 4.1.1)@trivago/prettier-plugin-sort-imports: 6.0.2Suggested fix
Add a
compatiblearray to thesveltedefineTransformcall mirroring the one used forbabel/typescript, e.g.:defineTransform({ staticAttrs: ["class"], + compatible: ["@trivago/prettier-plugin-sort-imports"], load: [{ name: "prettier-plugin-svelte", importer: () => import("prettier-plugin-svelte") }], parsers: { svelte: {} }, ... })NOTE: unless I'm mistaken, trivago's is the only plugin providing Svelte support.