Skip to content

Fix repeated blank lines before exported decorators - #20180

Open
charan-rathore wants to merge 5 commits into
prettier:mainfrom
charan-rathore:fix-export-decorator-blank-lines-20175
Open

charan-rathore wants to merge 5 commits into
prettier:mainfrom
charan-rathore:fix-export-decorator-blank-lines-20175

Conversation

@charan-rathore

Copy link
Copy Markdown

Description

Fixes #20175. A leading comment between export and a decorator already prints its own separator. The decorator printer added a hardline too, so formatting the result again added another blank line. It now leaves that extra hardline out when the comment sits before the first decorator. This preserves a blank line if one was already in the input and leaves export declarations without that comment unchanged.

The TypeScript fixture covers both issue examples, a pre-existing blank line, multiple decorators, default export, and a comment after a decorator. The snapshot and formatter's two-pass checks confirm the output is stable. Inline block comments remain inline with the decorator, rather than using the multiline layout suggested in the issue.

Instinct assisted with the change and tests.

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). (Not applicable: no API or CLI change.)
  • (If the change is user-facing) I've added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md. (Rename 20175.md and heading to the PR number when known.)
  • I've read the contributing guidelines. (Charan should check this himself.)
  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting. (Leave unchecked until Charan personally reviews and can attest.)

Added locStart import and improved comment handling for decorators.
Prettier now maintains comment placement before exported decorators, preventing additional blank lines during formatting.
@agentscanapp

agentscanapp Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Automation signals

Activity patterns show signs of automation.

View full analysis →

Report this account →

Evidence
  • Closed PRs across many repositories: 53 PRs were closed across 29 repositories in 8d, with spike days of 14 and 13 closures each.
  • High comment frequency across repos: 26 comments to 13 different repos in 1 minute

Last 5 PRs:

This is an automated analysis by AgentScan

Updated changelog entry for issue prettier#20180 to reflect changes regarding comments before exported decorators.
@netlify

netlify Bot commented Sep 29, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 056f3cd
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6abb55651dc207000823c173
😎 Deploy Preview https://deploy-preview-20180--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@netlify

netlify Bot commented Sep 29, 2026

Copy link
Copy Markdown

✅ Deploy Preview for prettier ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 2a9339a
🔍 Latest deploy log https://app.netlify.com/projects/prettier/deploys/6abb558b1dc207000823c199
😎 Deploy Preview https://deploy-preview-20180--prettier.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@charan-rathore

Copy link
Copy Markdown
Author

Sorry, this was closed by mistake, reopening.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Comment between export and a decorator adds a blank line on every format

1 participant