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

feat: support prettier v3 #195

Merged
merged 2 commits into from
Jul 16, 2023
Merged

feat: support prettier v3 #195

merged 2 commits into from
Jul 16, 2023

Conversation

auvred
Copy link
Contributor

@auvred auvred commented Jul 11, 2023

Closes #194

This PR includes a lot of changes, I tried to make them as few as possible, so I didn't run prettier -w, to prevent formatting that might complicate the PR review.

Checklist:

If I missed something, please correct me.


P.S.

  1. It'd be nice to update all the dependencies, because they're very outdated... I can do this in this or another PR
    image

  2. It seems that the umd build is incorrect, because when I past

<script src="https://www.unpkg.com/prettier-plugin-jsdoc"></script>

to the webpage, it throws this
image
image

TODO after review:

  • Bump dependencies
  • Run prettier -w
  • Fix standalone build

node: [12.x, 14.x, 16.x, 18.x]
prettier: [2.1, 2.2, 2.4, latest]
node: [14.x, 16.x, 18.x, 20.x]
prettier: [3.0]
Copy link
Owner

Choose a reason for hiding this comment

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

This is not acceptable, we can't remove compatibility of old version of prettier

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess it would be hard to maintain both sync and async version of plugin. [email protected] is stable enough to work with prettier@2, so maybe we can release a new major version 1.0.0 that will support only prettier@3 and add to README something like:

This plugin is compatible with [email protected], but if you want to use this plugin with [email protected], then you can install it with npm i prettier-plugin-jsdoc@prettier-v2


Prettier v2 will no longer receive updates and the plugin ecosystem is already moving towards prettier v3 adoption

The official plugins already dropped prettier@2 support:


Also migration to ESM will allow us not to include mdast-util-from-markdown to the bundle and significantly reduce package size. Otherwise if we will include both sync and async versions, the package size will only grow

package.json Outdated
"typescript": "^4.4.4"
},
"peerDependencies": {
"prettier": ">=2.1.2"
"prettier": ">=3.0.0"

Choose a reason for hiding this comment

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

Please do not make the same mistake as your predecessors. The peer dependency should be declared with ^ or ~, not >=

Also, it would be fair to correct the peer dependency on prettier of the current 0.4 line of this plugin to read ^2.1.2

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, thanks! I changed it to ^3.0.0

@hosseinmd hosseinmd merged commit 5a816c9 into hosseinmd:master Jul 16, 2023
@so1ve
Copy link

so1ve commented Jul 17, 2023

@hosseinmd Hi, thanks for supporting prettier v3! How about creating a new release? :)

turadg added a commit to Agoric/agoric-sdk that referenced this pull request Jul 17, 2023
@turadg
Copy link

turadg commented Jul 17, 2023

Looking forward to a release of this.

I also nominate @auvred as an additional maintainer for this important project.

@hosseinmd
Copy link
Owner

What version you are suggesting to release this change? It seems like a breaking change, so we should move to 1.0.0

@hosseinmd
Copy link
Owner

In addition, need to be mention in README, compatible versions with prettier v3 and v2

@so1ve
Copy link

so1ve commented Jul 18, 2023

Maybe 1.0.0 / 0.5.0 (major is 0 means this package is not stable yet) ?

@hosseinmd
Copy link
Owner

I think it is ok to release major version.

@turadg
Copy link

turadg commented Jul 18, 2023

I think it is ok to release major version.

Your project but in my experience, it's still not stable. Per https://semver.org/, Until you release 1.0 there is no obligation to bump the major version on breaking changes. Once you do this, any breaking change will require a major version bump.

I would request that you release as 0.5.0 so as to maintain flexibility in designing the options and their defaults.

@danielpza
Copy link
Collaborator

danielpza commented Jul 18, 2023

Once you do this, any breaking change will require a major version bump.

I agree. On the other hand this is a very popular package that is already used in production by a lot of projects
image

semver.org states:

How do I know when to release 1.0.0?
If your software is being used in production, it should probably already be 1.0.0. If you have a stable API on which users have come to depend, you should be 1.0.0. If you’re worrying a lot about backward compatibility, you should probably already be 1.0.0.

Doesn’t this discourage rapid development and fast iteration?
Major version zero is all about rapid development. If you’re changing the API every day you should either still be in version 0.y.z or on a separate development branch working on the next major version.

I think both jumping to v1.0.0 or staying in v0.x.x are both valid

@danielpza
Copy link
Collaborator

danielpza commented Jul 18, 2023

Will every change in the formatting output constitute a breaking change in the future?

@turadg
Copy link

turadg commented Jul 18, 2023

Will every change in the formatting output constitute a breaking change in the future?

No, some formatting output changes will be necessary to fix bugs.

But changes in intent (such as flipping a default or removing an option) will be breaking changes. And ofc anything that throws an error.

@hosseinmd
Copy link
Owner

In my opinion, this is a breaking change for someone who doesn't want to move to prettier v3, so if anybody installed this by caret ^0.4.x might get 0.5.0 then break. We should prevent them to get this version, so we should release major version

@so1ve
Copy link

so1ve commented Jul 19, 2023

@hosseinmd IMO this package's major version is 0, which means it may introduce breaking changes in any minor version change. But I don't mind whether you release a major or minor! :)

@hosseinmd
Copy link
Owner

So, I released v1.0.0. Thank you.

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.

Support Prettier 3.0.0
6 participants