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

Include prettier-plugin-sql-cst to community plugins list #14408

Merged
merged 2 commits into from Mar 2, 2023

Conversation

nene
Copy link
Contributor

@nene nene commented Feb 23, 2023

Description

This PR adds link to prettier-plugin-sql-cst to the list of community plugins.

Admittedly, this is an attempt to promote an SQL-formatting plugin that I have written. There already exists an SQL-plugin in this list, so why do I suggest adding another one?

The existing SQL plugin simply wraps an existing sql-formatter library, which doesn't really format the code in the way Prettier itself does. I know its limitations quite well, as I'm actually the author of that library.

The new plugin uses the actual Prettier formatting algorithm to lay out the code and is also much more in line with the philosophy of Prettier, by providing almost no configuration options and having a very opinionated approach to SQL code style.

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

Copy link
Member

@fisker fisker left a comment

Choose a reason for hiding this comment

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

Looks great! Can you make it work on Prettier 3? We are close to release it.

How to migrate my plugin to support Prettier v3?

@fisker
Copy link
Member

fisker commented Feb 23, 2023

You may want copy change to /website/versioned_docs/version-stable/plugins.md as well, so the website will undate, otherwise, it will be updated until next release.

@nene
Copy link
Contributor Author

nene commented Feb 23, 2023

Thanks. I copied by change to /website/versioned_docs/version-stable/plugins.md

Thanks also for pointers about Prettier 3.0. I'll see if I can make it work.

@nene
Copy link
Contributor Author

nene commented Feb 23, 2023

Just a quick question about 3.0...

Would you expect plugin developers to support both 2.x and 3.x in their plugins, or would you expect the plugins to completely ditch 2.x support and only support 3.x?

@fisker
Copy link
Member

fisker commented Feb 23, 2023

It's possible to make it work for v2 and v3. Depends on you want your user to use v2 or not.

@nene
Copy link
Contributor Author

nene commented Feb 23, 2023

Thanks. In my case I will probably just ditch 2.x support as I don't really have any users yet.

@nene
Copy link
Contributor Author

nene commented Feb 23, 2023

Looked into upgrading to 3.x, but unfortunately the @types/prettier doesn't yet support 3.x. As my plugin relies heavily on TypeScript, I'll have to either wait for the new type definitions or contribute my own to DefinitelyTyped before I can start adopting 3.x.

@fisker
Copy link
Member

fisker commented Mar 2, 2023

Released 3.0.0-alpha.5 with type definitions.

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.

None yet

2 participants