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

Improve compat with other prettier plugins #175

Closed
wants to merge 3 commits into from

Conversation

IanVS
Copy link
Owner

@IanVS IanVS commented Jun 25, 2024

This is based on the approach in https://github.com/hosseinmd/prettier-plugin-jsdoc/tree/master, which allows other plugins some ability to work alongside this plugin (so long as this one is specified last, or used together with another plugin that interoperates.

I think there's the possibility of an infinite loop though depending on the order that plugins are specified, which I still need to look into in order to make sure we don't break existing users.

IanVS added 3 commits June 25, 2024 17:29
And fix a few types while we're at it.
16 is deprecated, and we need 18 for .findLast
Uses some actual other plugins, which could be brittle, but on the other hand,
should give us greater confidence that it's working
"lib": ["es2023"],
"module": "node16",
"moduleResolution": "node16",
"target": "es2022",
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing from 2021 to 2022 could have an impact on the minimum version of node that we support, basically changing the minor version of node 16 that is required. Whether we actually use any of the features that aren't supported in early 16 versions, I'm not sure. So maybe best to save this for a breaking version later on.

@IanVS
Copy link
Owner Author

IanVS commented Jun 26, 2024

Confirmed, there's an infinite loop that occurs if this change is made and the plugin is used together with prettier-plugin-jsdoc. Maybe there's a way around it, but I don't think so, at least not with this approach. We'd need to do something like tailwindcss, with an allowlist of compatible plugins, but that seems like too much work right now.

I'm going to close this out, and propose that we don't worry about it unless we hear from users that are having problems with other plugins. And hopefully in the meantime Prettier will create a better API for plugins to work together in a pipeline.

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.

1 participant