Skip to content

TypeScript: Fix issue with double semicolon caused by // prettier-ignore on a call signature line#14830

Merged
fisker merged 3 commits intoprettier:mainfrom
oki07:fix-call-signature-issue
May 19, 2023
Merged

TypeScript: Fix issue with double semicolon caused by // prettier-ignore on a call signature line#14830
fisker merged 3 commits intoprettier:mainfrom
oki07:fix-call-signature-issue

Conversation

@oki07
Copy link
Contributor

@oki07 oki07 commented May 17, 2023

Description

Fixes #14786

Fix to not insert a semicolon at the end of a call signature line with prettier-ignore comment.

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

@oki07 oki07 marked this pull request as ready for review May 17, 2023 10:44
Copy link
Contributor

@sosukesuzuki sosukesuzuki left a comment

Choose a reason for hiding this comment

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

Thank you!

Copy link
Member

@kachkaev kachkaev left a comment

Choose a reason for hiding this comment

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

Nice and clean, thanks @ot07 👏

prop.node.type === "TSMethodSignature" ||
prop.node.type === "TSConstructSignatureDeclaration") &&
prop.node.type === "TSConstructSignatureDeclaration" ||
prop.node.type === "TSCallSignatureDeclaration") &&
Copy link
Member

@fisker fisker May 18, 2023

Choose a reason for hiding this comment

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

Looks like these types are not like Property(semi belong to them, but comma not belong to Property).

Have to say we are not printing them correctly, but not your fault. We should fix in future.

@fisker fisker merged commit 9b19afd into prettier:main May 19, 2023
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Feb 15, 2024
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.

Bug report: using // prettier-ignore on a call signature line leads to broken code on format

5 participants