Skip to content

Conversation

astrochemx
Copy link
Contributor

@astrochemx astrochemx commented Jun 17, 2025

Hi, Tailwind Team!
Thank you for the awesome plugin!

Overview

This PR updates the load order of plugins compatible with prettier-plugin-tailwindcss for proper interoperability.

It also removes the obsolete comment about plugins commented out due to incompatibility with Prettier 3.0.

🧐 The Problem

Certain Prettier plugins, like prettier-plugin-multiline-arrays, may cause conflicts or unexpected behavior when loaded in the wrong order, leading to formatting issues or plugin failures.

In my case, prettier-plugin-jsdoc fails to apply its formatting when used with both prettier-plugin-multiline-arrays and prettier-plugin-tailwindcss, but works correctly when prettier-plugin-tailwindcss is excluded and the plugin order is properly set.

💡 The Solution

The loadCompatiblePlugins function has been updated to enforce a specific plugin load order for proper interoperability. The updated code includes a curated list of plugins with a defined sequence.

✔️ Testing

Due to time constraints, I performed only initial testing using the pnpm patch feature with the following Prettier configuration:

/** @type {import("prettier").Config} */
export default {
  multilineArraysWrapThreshold: 0,
  plugins: [
    "prettier-plugin-multiline-arrays",
    "prettier-plugin-jsdoc",
    "prettier-plugin-tailwindcss",
  ],
};

The changes resolved the formatting issue between these plugins in my local setup.

Warning

I’d greatly appreciate it if someone could conduct more comprehensive testing to confirm the plugin load order ensures compatibility across all supported plugins. Although, I plan to conduct additional testing myself when time permits.

🔖 Additional Info

  1. Plugin load order recommendations for prettier-plugin-multiline-arrays compatibility
  2. Issue discussing the load order of prettier-plugin-jsdoc and @ianvs/prettier-plugin-sort-imports plugins when used with prettier-plugin-multiline-arrays

Looking forward to your review and feedback.
Thanks! 🫶

@thecrypticace
Copy link
Contributor

thecrypticace commented Jun 17, 2025

Hey, @astrochemx. Can you provide a repro of the issue you are seeing? That list is about loading the plugin modules rather than running them in a specific order so I'm curious to know what / how things break.

@astrochemx
Copy link
Contributor Author

astrochemx commented Jun 17, 2025

Hi, @thecrypticace!

Please, try this: https://github.com/astrochemx/prettier-plugin-tailwindcss-repro

There are 2 branches - main with the original plugin and patched with the patched by pnpm patch plugin.

I hope it helps!

Note

The scripts in package.json are self-explanatory

P.S.: I've also updated the config in the PR because I initially forgot to include multilineArraysWrapThreshold: 0

@thecrypticace
Copy link
Contributor

Wow, okay. That is surprising. We actually have to load the plugins in a given order. I wonder if our use of Promise.all indicates a potential race condition or not. 🤔

I imagine, if one is possible, it's probably rather unlikely. I'll want to add a test for this because 100% this will break in the future during some refactor if I don't 😄

@thecrypticace thecrypticace merged commit 2bc173a into tailwindlabs:main Jun 17, 2025
1 check passed
@thecrypticace
Copy link
Contributor

Thanks! I need to get a release out soon so that'll maybe happen sometime this week 👍

@astrochemx
Copy link
Contributor Author

Awesome! 🎉

I'll be waiting for the new release!

Thank you, Jordan! 🤝

Nick2bad4u added a commit to Nick2bad4u/UserStyles that referenced this pull request Sep 2, 2025
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)


<h3>Snyk has created this PR to upgrade prettier-plugin-tailwindcss from
0.6.13 to 0.6.14.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **1 version** ahead of your current
version.

- The recommended version was released **23 days ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>prettier-plugin-tailwindcss</b></summary>
    <ul>
      <li>
<b>0.6.14</b> - <a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/releases/tag/v0.6.14">2025-07-09</a></br><ul>
<li>Add support for OXC + Hermes Prettier plugins (<a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/376"
data-hovercard-type="pull_request"
data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/376/hovercard">#376</a>,
<a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/380"
data-hovercard-type="pull_request"
data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/380/hovercard">#380</a>)</li>
<li>Sort template literals in Angular expressions (<a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/377"
data-hovercard-type="pull_request"
data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/377/hovercard">#377</a>)</li>
<li>Don't repeatedly add backslashes to escape sequences when formatting
(<a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/381"
data-hovercard-type="pull_request"
data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/381/hovercard">#381</a>)</li>
</ul>
      </li>
      <li>
<b>0.6.13</b> - <a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/releases/tag/v0.6.13">2025-06-19</a></br><ul>
<li>Prevent Svelte files from breaking when there are duplicate classes
(<a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/359"
data-hovercard-type="pull_request"
data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/359/hovercard">#359</a>)</li>
<li>Ensure <code>prettier-plugin-multiline-arrays</code> and
<code>prettier-plugin-jsdoc</code> work when used together with this
plugin (<a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/pull/372"
data-hovercard-type="pull_request"
data-hovercard-url="/tailwindlabs/prettier-plugin-tailwindcss/pull/372/hovercard">#372</a>)</li>
</ul>
      </li>
    </ul>
from <a
href="https://redirect.github.com/tailwindlabs/prettier-plugin-tailwindcss/releases">prettier-plugin-tailwindcss
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiIyZTI4NzFkYS0zYjg3LTRiODMtYTRjMC1hNWJjMjU0OGE5NzEiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6IjJlMjg3MWRhLTNiODctNGI4My1hNGMwLWE1YmMyNTQ4YTk3MSJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88/settings/integration?pkg&#x3D;prettier-plugin-tailwindcss&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"prettier-plugin-tailwindcss","from":"0.6.13","to":"0.6.14"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"2e2871da-3b87-4b83-a4c0-a5bc2548a971","prPublicId":"2e2871da-3b87-4b83-a4c0-a5bc2548a971","packageManager":"npm","priorityScoreList":[],"projectPublicId":"fbcde33d-0af3-42e5-87f7-b8fdd4c91c88","projectUrl":"https://app.snyk.io/org/nick2bad4u/project/fbcde33d-0af3-42e5-87f7-b8fdd4c91c88?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-07-09T19:09:50.420Z"},"vulns":[]}'
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

Successfully merging this pull request may close these issues.

2 participants