-
-
Notifications
You must be signed in to change notification settings - Fork 499
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): fix invalid formatting of long arrow function for AsNeeded arrow parens #1934
Conversation
✅ Deploy Preview for biomejs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Cool |
@@ -214,7 +214,7 @@ pub(crate) fn should_hug_function_parameters( | |||
) -> FormatResult<bool> { | |||
/// Returns true if the first parameter should be forced onto the same line as the `(` and `)` parentheses. | |||
/// See the `[ParameterLayout::Hug] documentation. | |||
fn hug_formal_parameter(parameter: &self::AnyJsFormalParameter) -> FormatResult<bool> { | |||
fn hug_formal_parameter(parameter: &self::AnyJsFormalParameter, from_arrow_function: bool, has_parentheses: bool) -> FormatResult<bool> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just add a simple judge here to deal this case.
d5f5114
to
fab646a
Compare
CodSpeed Performance ReportMerging #1934 will improve performances by 8.52%Comparing Summary
Benchmarks breakdown
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fix has caused our compatibility ratio with prettier. I am going to block it in advance and see if there's a better fix.
My initial advice is to look at Prettier's logic/behaviour.
The second advice is to understand if we really want to accept this change, because if so, we need to diverge.
crates/biome_js_formatter/tests/specs/prettier/typescript/generic/arrow-return-type.ts.snap
Outdated
Show resolved
Hide resolved
ee02ecc
to
2cf766f
Compare
I updated this pr, PTAL for free~ @ematipico |
98198f9
to
6a44f6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's more like it! Great contribution, thank you @fireairforce!
it seems the ci block? i think it has nothing to do with this PR |
…AsNeeded arrow parens
Summary
Fixes: #1905
Test Plan