Repository navigation
Fix repeated blank lines before exported decorators - #20180
Open
charan-rathore wants to merge 5 commits into
Open
charan-rathore wants to merge 5 commits into
charan-rathore wants to merge 5 commits into
Conversation
Added locStart import and improved comment handling for decorators.
Prettier now maintains comment placement before exported decorators, preventing additional blank lines during formatting.
Automation signalsActivity patterns show signs of automation. Evidence
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.
✅ Deploy Preview for prettier ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for prettier ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Author
|
Sorry, this was closed by mistake, reopening. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #20175. A leading comment between
exportand 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
docs/directory). (Not applicable: no API or CLI change.)changelog_unreleased/*/XXXX.mdfile followingchangelog_unreleased/TEMPLATE.md. (Rename 20175.md and heading to the PR number when known.)