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(format/js): fix arrow function type annotation inconsistency with prettier #2766

Conversation

dyc3
Copy link
Contributor

@dyc3 dyc3 commented May 8, 2024

Summary

This fixes a minor output mismatch with prettier related to arrow functions.

fixes #2736

Test Plan

Prettier has this condition when determining layout:
https://github.com/prettier/prettier/blob/fde0b49d7866e203ca748c306808a87b7c15548f/src/language-js/print/assignment.js#L145

I've added some snapshot tests based on the the playgrounds in #2736, but I'm not sure if I did it right.

cargo test -p biome_js_formatter

@github-actions github-actions bot added A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages labels May 8, 2024
Copy link

codspeed-hq bot commented May 8, 2024

CodSpeed Performance Report

Merging #2766 will not alter performance

Comparing dyc3:05-08-fix_format_js_fix_arrow_function_type_annotation_inconsistency_with_prettier (47785ba) with main (a686a1c)

Summary

✅ 97 untouched benchmarks

@dyc3 dyc3 force-pushed the 05-08-fix_format_js_fix_arrow_function_type_annotation_inconsistency_with_prettier branch from 675ae89 to 90e5428 Compare May 8, 2024 21:09
@dyc3 dyc3 marked this pull request as ready for review May 8, 2024 21:11
@dyc3

This comment was marked as resolved.

@dyc3 dyc3 force-pushed the 05-08-fix_format_js_fix_arrow_function_type_annotation_inconsistency_with_prettier branch from 90e5428 to 689a6ee Compare May 9, 2024 11:47
@dyc3 dyc3 force-pushed the 05-08-fix_format_js_fix_arrow_function_type_annotation_inconsistency_with_prettier branch 2 times, most recently from eedb263 to 61ad32e Compare May 10, 2024 11:58
@dyc3 dyc3 force-pushed the 05-08-fix_format_js_fix_arrow_function_type_annotation_inconsistency_with_prettier branch from 61ad32e to 47785ba Compare May 10, 2024 12:38
Copy link
Contributor

@ah-yu ah-yu left a comment

Choose a reason for hiding this comment

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

Great fix!

@ah-yu ah-yu merged commit 7245146 into biomejs:main May 10, 2024
12 checks passed
@dyc3 dyc3 deleted the 05-08-fix_format_js_fix_arrow_function_type_annotation_inconsistency_with_prettier branch September 4, 2024 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Formatter Area: formatter L-JavaScript Language: JavaScript and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arrow function body indentation affected by its type length
3 participants