-
-
Notifications
You must be signed in to change notification settings - Fork 717
refactor(formatter): improve handling of type cast node #14815
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
refactor(formatter): improve handling of type cast node #14815
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
CodSpeed Performance ReportMerging #14815 will not alter performanceComparing Summary
Footnotes
|
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.
Pull Request Overview
This PR refactors the handling of TypeScript type cast nodes by extracting the detection logic into a separate function, improving code reusability and maintainability.
Key changes:
- Extracted type cast node detection logic into a new
is_type_cast_nodehelper function - Simplified
format_type_cast_comment_nodeby utilizing the new helper - Moved and improved the
matches_pattern_athelper function inside theis_type_cast_commentmethod
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_formatter/src/utils/typecast.rs | Introduces is_type_cast_node helper function and refactors format_type_cast_comment_node to use it |
| crates/oxc_formatter/src/utils/member_chain/mod.rs | Replaces inline type cast detection logic with call to new is_type_cast_node helper |
| crates/oxc_formatter/src/formatter/comments.rs | Moves matches_pattern_at helper inside is_type_cast_comment method and updates implementation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
f2c0f54 to
f52863d
Compare
## [0.7.0] - 2025-10-21 ### 🚀 Features - 6dfcd80 oxfmt: Search both .json and .jsonc config file (#14848) (leaysgur) - aa024d9 formatter: Wrap parenthesis for `AssignmentExpression` that are inside `ComputedMemberExpression` (#14834) (Dunqing) ### 🐛 Bug Fixes - 88fb768 formatter: Correct handling of ignore comment for `TSUnionType` and `TSMappedType` (#14824) (Dunqing) - f7727c7 formatter: Ignore comment doesn't work for the expression statement (#14817) (Dunqing) - 7a420a1 oxfmt: Handle `.d.ts` file correctly (#14835) (leaysgur) ### 🚜 Refactor - 6fa7420 oxfmt: Use custom ignore builder (#14850) (leaysgur) - 9d914a3 formatter: Improve comments handling (#14816) (Dunqing) - f52863d formatter: Improve handling of type cast node (#14815) (Dunqing)

No description provided.