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): format hook with 3 arguments #4462

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vohoanglong0107
Copy link
Contributor

Summary

Currently the hook detection in JS formatter only recognizes hooks with 2 arguments. This PR updates the formatter to also recognize hooks with 3 arguments.

Fix #4262

Test Plan

Added new test with the useImperativeHandle hook, a 3 arguments hook.

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

codspeed-hq bot commented Nov 4, 2024

CodSpeed Performance Report

Merging #4462 will not alter performance

Comparing vohoanglong0107:fix-js-formatter-format-hooks (0eade7a) with main (3f152b3)

Summary

✅ 99 untouched benchmarks

@vohoanglong0107 vohoanglong0107 marked this pull request as ready for review November 4, 2024 11:16
@vohoanglong0107 vohoanglong0107 requested a review from a team November 4, 2024 11:17
@ematipico
Copy link
Member

@vohoanglong0107 FYI remember to add @biomejs/core-contributors too when requesting for code review. If you check the maintainers team, it doesn't contain the members that belong to the core contributors team

@vohoanglong0107 vohoanglong0107 requested a review from a team November 5, 2024 01:56
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.

You created the test in the wrong folder, the prettier folder should stay as is. Create a new test inside specs, maybe here: https://github.com/biomejs/biome/tree/main/crates%2Fbiome_js_formatter%2Ftests%2Fspecs%2Fjs%2Fmodule

@@ -31,3 +31,7 @@ expect(
bar;
},
).toThrow(ReferenceError);

useImperativeHandle(ref, () => {
Copy link
Member

Choose a reason for hiding this comment

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

These tests are coming from prettier repository, so they should not be modified

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.

📝 Formatter got a different result than Prettier
2 participants