+
Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

fix(rome_js_formatter): Arrow chain trailing comments #3398

Merged
merged 1 commit into from
Oct 11, 2022

Conversation

MichaReiser
Copy link
Contributor

This PR fixes an issue where trailing comments of arrow expressions that are part of an arrow chain (arrow expressions that are the body of another arrow) were dropped.

The manual handling of comments is necessary because the arrow chain formatting doesn't call into the FormatJsArrowFunctionExpression of nested arrow functions.

The implementation already handles the formatting of leading comments correctly.

Tests

I added a new snapshot test and verified that running rome format on prettier yields no more "dropped comments" errors.

This PR fixes an issue where trailing comments of arrow expressions that are part of an arrow chain (arrow expressions that are the body of another arrow) were dropped.

The manual handling of comments is necessary because the arrow chain formatting doesn't call into the `FormatJsArrowFunctionExpression` of nested arrow functions.

The implementation already handles the formatting of leading comments correctly.

## Tests

I added a new snapshot test and verified that running rome format on prettier yields no more "dropped comments" errors.
@MichaReiser MichaReiser added the A-Formatter Area: formatter label Oct 11, 2022
@MichaReiser MichaReiser added this to the 10.0.0 milestone Oct 11, 2022
@netlify
Copy link

netlify bot commented Oct 11, 2022

Deploy Preview for rometools canceled.

Name Link
🔨 Latest commit d7fbddc
🔍 Latest deploy log https://app.netlify.com/sites/rometools/deploys/634546fa3941a80007af7af2

@MichaReiser MichaReiser temporarily deployed to netlify-playground October 11, 2022 10:35 Inactive
@github-actions
Copy link

@MichaReiser MichaReiser merged commit b1b24b7 into main Oct 11, 2022
@MichaReiser MichaReiser deleted the fix/arrow-chain-comments branch October 11, 2022 11:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Formatter Area: formatter
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载