Skip to content
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

plugin must be specified after pretter-plugin-tailwindcss #201

Closed
adamhl8 opened this issue Feb 2, 2025 · 1 comment
Closed

plugin must be specified after pretter-plugin-tailwindcss #201

adamhl8 opened this issue Feb 2, 2025 · 1 comment
Assignees

Comments

@adamhl8
Copy link

adamhl8 commented Feb 2, 2025

Related to #36

I know that the prettier plugin API is limited and only one plugin can interact with the AST at a time. According to the prettier-plugin-tailwindcss readme, the tailwindcss plugin is supposed to be last.

However, I noticed that my imports weren't getting sorted and eventually figured out that everything works if I put this plugin last. Not really sure if that's a bug or unexpected, but figured I'd open this issue for visibility in case anyone else runs into the same thing. See my next comment.

So to be clear, this works:

export default {
  plugins: [
    "prettier-plugin-astro",
    "prettier-plugin-tailwindcss",
    "@ianvs/prettier-plugin-sort-imports",
  ],
  // ...
}

This doesn't work:

export default {
  plugins: [
    "@ianvs/prettier-plugin-sort-imports",
    "prettier-plugin-astro",
    "prettier-plugin-tailwindcss",
  ],
  // ...
}

Might be worth putting a note in the readme that this plugin should come last?

@adamhl8
Copy link
Author

adamhl8 commented Feb 11, 2025

Turns out another prettier plugin I was using was causing the issue, specifically prettier-plugin-jsdoc. Putting the plugins in the order suggested by prettier-plugin-tailwindcss does work.

@adamhl8 adamhl8 closed this as completed Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants