Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(js_formatter): add parentheses for the return expression that has leading multiline comments. #2504

Merged
merged 4 commits into from
Apr 18, 2024

Conversation

ah-yu
Copy link
Contributor

@ah-yu ah-yu commented Apr 18, 2024

Summary

Fix the following case

// input
function f() {
    return (
        /*
         * multiline comment 
         */ '1'
    )
}

// before
function f() {
  return /*
   * multiline comment
   */ "1";
}

// after
// add parentheses for the return expression that has multiline leading comments
function f5() {
  return (
    /*
     * multiline comment
     */ "1"
  );
}

Test Plan

Add new test cases and enable the prettier test case that disabled before due to reformatting issue

@github-actions github-actions bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels Apr 18, 2024
@ah-yu ah-yu changed the title fix(js_formatter): add parentheses for expressions that have leading multiline comments. fix(js_formatter): add parentheses for the return expression that has leading multiline comments. Apr 18, 2024
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome!

@github-actions github-actions bot added A-Website Area: website A-Changelog Area: changelog labels Apr 18, 2024
Copy link

codspeed-hq bot commented Apr 18, 2024

CodSpeed Performance Report

Merging #2504 will degrade performances by 50.89%

Comparing ah-yu:refmt_return_stmt (48f1be5) with main (dbab2b9)

Summary

❌ 1 regressions
✅ 92 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main ah-yu:refmt_return_stmt Change
big5-added.json[uncached] 2.7 ms 5.6 ms -50.89%

@ematipico ematipico merged commit 3d0b473 into biomejs:main Apr 18, 2024
12 of 13 checks passed
@ah-yu ah-yu deleted the refmt_return_stmt branch April 18, 2024 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Changelog Area: changelog A-Formatter Area: formatter A-Website Area: website L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants