Fix blank lines inserted between consecutive comment lines#49
Merged
jdeniau merged 1 commit intomapado:mainfrom May 8, 2026
Merged
Conversation
When a comment block leads a step that requires a leading hardline (e.g. with `forceNewlineBetweenStepBlocks: true`), only the first comment in the contiguous block now prepends the hardline. Subsequent comments rely on prettier's own join between leading own-line comments, so multi-line comment blocks no longer get blank lines inserted between every line. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jdeniau
approved these changes
May 4, 2026
Member
jdeniau
left a comment
There was a problem hiding this comment.
Nice catch, thanks for this fix.
Contributor
Author
|
Thanks for approving @jdeniau! When do you think this could get merged? We are currently manually patching this in our repo, but ideally we can get rid of that patch once this has been released. |
Member
|
3.1.4 is released 👍 |
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.
Closes #32
Summary
When a
#comment block leads a step that requires a leading hardline (e.g. withforceNewlineBetweenStepBlocks: true, or when there was already a blank line before the previous step), every comment in the block currently has a hardline prepended individually. Prettier joins leading own-line comments with its own hardline, so the result is a blank line inserted between every consecutive comment line.This change makes only the first comment in a contiguous leading block prepend the hardline; subsequent comments rely on prettier's join. Multi-line
#comment blocks now stay together as a single block with at most one blank line in front of them.A new fixture
tests/plugin/multiple_comments_line_before_step.featurecovers the case (a multi-line comment block leading aGivenafter aWhen, exercised againstforceNewlineBetweenStepBlocks: true). The existingmultiple_comments_line.featuresnapshot is unchanged.Test plan
yarn test— 54/54 pass🤖 Generated with Claude Code