Skip to content

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Oct 20, 2025

No description provided.

@github-actions github-actions bot added A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Oct 20, 2025
Copy link
Member Author

Dunqing commented Oct 20, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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-hq
Copy link

codspeed-hq bot commented Oct 20, 2025

CodSpeed Performance Report

Merging #14815 will not alter performance

Comparing 10-20-refactor_formatter_improve_handling_of_type_cast_node (f2c0f54) with main (1fcf56c)

Summary

✅ 33 untouched
⏩ 4 skipped1

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Dunqing Dunqing changed the title refactor(formatter): improve handling of type cast node\ refactor(formatter): improve handling of type cast node Oct 20, 2025
@Dunqing Dunqing marked this pull request as ready for review October 20, 2025 16:38
Copilot AI review requested due to automatic review settings October 20, 2025 16:38
Copy link
Contributor

Copilot AI left a 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_node helper function
  • Simplified format_type_cast_comment_node by utilizing the new helper
  • Moved and improved the matches_pattern_at helper function inside the is_type_cast_comment method

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.

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 21, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 10-20-refactor_formatter_improve_handling_of_type_cast_node branch from f2c0f54 to f52863d Compare October 21, 2025 04:36
@graphite-app graphite-app bot merged commit f52863d into main Oct 21, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 10-20-refactor_formatter_improve_handling_of_type_cast_node branch October 21, 2025 04:42
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Oct 21, 2025
@Boshen Boshen mentioned this pull request Oct 21, 2025
graphite-app bot pushed a commit that referenced this pull request Oct 21, 2025
## [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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants