Skip to content

prettier-plugin-tailwind should be inserted to end of plugin list #843

@GrygrFlzr

Description

@GrygrFlzr

As per https://github.com/tailwindlabs/prettier-plugin-tailwindcss?tab=readme-ov-file#compatibility-with-other-prettier-plugins

[prettier-plugin-tailwind] uses Prettier APIs that can only be used by one plugin at a time, making it incompatible with other Prettier plugins implemented the same way. [...] One limitation with this approach is that prettier-plugin-tailwindcss must be loaded last.

Currently, sv instead pushes it to the top of the prettier plugin list:

const plugins: string[] = data.plugins;
if (tailwindcssInstalled) {
if (!plugins.includes('prettier-plugin-tailwindcss')) {
data.plugins.unshift('prettier-plugin-tailwindcss');
}
data.tailwindStylesheet ??= files.getRelative({ to: files.stylesheet });
}
if (!plugins.includes('prettier-plugin-svelte')) {
data.plugins.push('prettier-plugin-svelte');
}

At minimum, it should definitely come after prettier-plugin-svelte, as it's one of the plugins called out in the plugin README, and currently prevents prettier-plugin-tailwind from sorting class names.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpkg:addsv add

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions