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

Feature: Prettier Plugin Collision Resolution #27

Open
fbartho opened this issue May 25, 2022 · 2 comments
Open

Feature: Prettier Plugin Collision Resolution #27

fbartho opened this issue May 25, 2022 · 2 comments

Comments

@fbartho
Copy link
Collaborator

fbartho commented May 25, 2022

Is your feature request related to a problem?
Prettier Plug-ins can collide with each-other: tailwindlabs/prettier-plugin-tailwindcss#31

Describe the solution you'd like
It’d be smart to have a documented procedure for working around this. It could even include code-changes if necessary.

Describe alternatives you've considered

  • Ignore collisions, and leave it up to users to figure out
  • Manually make a merger plugin

I don’t think this is a breaking blocker-issue (shouldn’t be in the milestone for #22), but it’d be smart to have a plan

@vincerubinetti
Copy link

vincerubinetti commented Jul 27, 2023

Related discussion:

hosseinmd/prettier-plugin-jsdoc#200

It seems like plugin-jsdoc is taking into account other plugins and trying to preserve their modifications, whereas plugin-sort-imports is not, because I have to put jsdoc after sort-imports or else sort-imports overwrites jsdoc's work. Maybe you can look at how they did the preserving?

I don't know anything about the prettier or prettier plugin architecture, so I don't know how hard this would be. Seems like maybe prettier could've designed their APIs a bit better to more gracefully identify and handle collisions...

@IanVS
Copy link
Owner

IanVS commented Jun 26, 2024

I made an attempt to solve this in #175, but if we use the same approach as prettier-plugin-jsdoc, we end up in an infinite loop because each tries to run the other over and over. The tailwindcss plugin does things a bit differently, using an allowlist of compatible plugins, but I'm also not certain that wouldn't result in an infinite loop if we did the same.

So I'm not sure there's all that much we can do right now other than hope that Prettier creates a better api for plugins to operate in a pipeline.

But, if you're having problems with a specific prettier plugin, let us know which one it is here and maybe we can try something else later on like an allowlist.

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

3 participants