Skip to content

Fix JSDoc @param comments broken by shifted parentheses #17373

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

k-yle
Copy link

@k-yle k-yle commented Apr 17, 2025

Closes #5850, Closes #12967, Does not close #14564

Description

Fixed a bug that caused Prettier to move JSDoc comments containing /** @param */ in rare cases.
Prettier previously moved the JSDoc comment outside of the parentheses, causing the comment to be
disassociated from the function. This affects TypeScript's checkJs mode.

// Input
(/** @param {string} x */ function (x) {});

// Prettier stable
/** @param {string} x */ (function (x) {});

// Prettier main
(/** @param {string} x */ function (x) {});

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.

Copy link

netlify bot commented Apr 17, 2025

Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e42e16c
🔍 Latest deploy log https://app.netlify.com/sites/prettier/deploys/6800de3bef700400088874a5
😎 Deploy Preview https://deploy-preview-17373--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

pkg-pr-new bot commented Apr 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/prettier@17373

commit: e42e16c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant