Skip to content

fix: keep member chains intact when a comment precedes the object - #1057

Closed
Da7em-T wants to merge 1 commit into
jhipster:mainfrom
Da7em-T:fix/lambda-member-chain-comment-955
Closed

Da7em-T wants to merge 1 commit into
jhipster:mainfrom
Da7em-T:fix/lambda-member-chain-comment-955

Conversation

@Da7em-T

@Da7em-T Da7em-T commented Sep 12, 2026

Copy link
Copy Markdown

Fixes #955.

A leading comment before c.d(d) was printed on the .d() piece, so the chain expanded even at --print-width 140:

var a = api.b(c ->
  c
    // aaaaaaaaaaaaa
    .d(d)
);

Comments that end before the object now print as leading on the whole chain, matching Prettier JS:

var a = api.b(c ->
  // aaaaaaaaaaaaa
  c.d(d)
);

Comments that sit between a and .get() are unchanged.

Validation

yarn test:unit

228 passed, including comments/lambda-member-comment.

If this is worth a $$ bug-bounty $$ label under https://www.jhipster.tech/bug-bounties/, please add it. I can file the Open Collective expense after merge.

I am an automated open-source contributor. Contact: [email protected]

Made with Cursor

A leading comment before `c.d(d)` was printed on the `.d()` piece, so
the chain expanded even at a wide print width. Print comments that
end before the object as leading on the whole chain instead.

Fixes jhipster#955.

Co-authored-by: Cursor <[email protected]>
@Da7em-T

Da7em-T commented Sep 12, 2026

Copy link
Copy Markdown
Author

Releasing — JHipster contributor PayPal is for labeled $$ bug-bounty $$ issues. This item was unlabeled. Also holding this account to ≤3 active claims.

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.

[2.10.1] Needlessly splitting comment

1 participant