hosseinmd / prettier-plugin-jsdoc

A Prettier plugin to format JSDoc comments.
MIT License
228 stars 29 forks source link

chore: remove unnecessary TypeScript `as` #220

Closed boyum closed 9 months ago

boyum commented 9 months ago

I read through some of the code and found some TypeScript as statements that seemed unnecessary. You'll of course decide for yourself if you want to do this change. No changes were done to the runtime JS code.

hosseinmd commented 9 months ago

LGTM, but actions failed, I don't know why. Also, I fixed one of them.

boyum commented 9 months ago

Thank you. I don't know either, they seem to work fine locally. It also seems to be an issue in master https://github.com/hosseinmd/prettier-plugin-jsdoc/actions/runs/7180581677/job/19553161503.

danielpza commented 9 months ago

It's because of an update in prettier, https://prettier.io/blog/2023/11/13/curious-ternaries

danielpza commented 9 months ago

Hmm, this is weird, the github actions workflow file says to try installing a 3.0.x prettier version, but the one that got installed was 3.1.1 which includes the new formatting changes:

https://github.com/hosseinmd/prettier-plugin-jsdoc/actions/runs/7180599499/workflow?pr=220#L17 image

https://github.com/hosseinmd/prettier-plugin-jsdoc/actions/runs/7180599499/job/19553214222?pr=220#step:6:16 image

hosseinmd commented 9 months ago

Are there any options for disabling that?

danielpza commented 9 months ago

I just noticed that yarn is installing prettier@3 instead of prettier@3.0. This is likely due to how yaml treats strings and numbers. Perhaps changing the github actions matrix for the prettier version to be explicitly an string would fix it:

https://github.com/hosseinmd/prettier-plugin-jsdoc/blob/2d7008fc968ef1afba4bb0bb94ac3ad4010ad00d/.github/workflows/test.yml#L17C7-L17C7

-        prettier: [3.0]
+        prettier: ["3.0"]
danielpza commented 9 months ago

See https://github.com/hosseinmd/prettier-plugin-jsdoc/pull/221

hosseinmd commented 9 months ago

Merged, Thanks.

hosseinmd commented 9 months ago

The presence of this issue in Prettier has unfortunately hindered our ability to test several older versions.

boyum commented 9 months ago

Nice ✨

hosseinmd commented 9 months ago

Thank you.