Skip to content

refactor(formatter/sort_imports): Use nodejs-built-in-modules to detect builtin#17773

Merged
graphite-app[bot] merged 1 commit intomainfrom
01-08-refactor_formatter_sort_imports_use_nodejs-built-in-modules_to_detect_builtin
Jan 8, 2026
Merged

refactor(formatter/sort_imports): Use nodejs-built-in-modules to detect builtin#17773
graphite-app[bot] merged 1 commit intomainfrom
01-08-refactor_formatter_sort_imports_use_nodejs-built-in-modules_to_detect_builtin

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Jan 8, 2026

Follow up #17771 (comment)

Copilot AI review requested due to automatic review settings January 8, 2026 01:36
@leaysgur leaysgur requested a review from Dunqing as a code owner January 8, 2026 01:36
@github-actions github-actions bot added A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Jan 8, 2026
Copy link
Member Author

leaysgur commented Jan 8, 2026


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.

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 import sorting functionality to use the nodejs-built-in-modules crate instead of maintaining a manually-defined list of Node.js builtin modules.

  • Replaces a static NODE_BUILTINS PHF set with a call to nodejs_built_in_modules::is_nodejs_builtin_module()
  • Adds nodejs-built-in-modules as a workspace dependency to oxc_formatter

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_formatter/src/ir_transform/sort_imports/compute_metadata.rs Removes the manually-maintained NODE_BUILTINS set and uses the nodejs_built_in_modules crate's function instead
crates/oxc_formatter/Cargo.toml Adds nodejs-built-in-modules workspace dependency
Cargo.lock Updates lock file with the new dependency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 8, 2026

Merging this PR will not alter performance

Summary

✅ 42 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing 01-08-refactor_formatter_sort_imports_use_nodejs-built-in-modules_to_detect_builtin (98120a9) with main (d7b5c0a)

Open in CodSpeed

Footnotes

  1. 3 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.

@leaysgur
Copy link
Member Author

leaysgur commented Jan 8, 2026

Cargo Deny failure is not related to this PR.

  error[unmaintained]: Bincode is unmaintained
  ├ ID: RUSTSEC-2025-0141
  ├ bincode v2.0.1
    └── oxc-browserslist v2.1.5
        └── oxc_compat v0.107.0

Refs: oxc-project/oxc-browserslist#454

@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Jan 8, 2026
Copy link
Member

Dunqing commented Jan 8, 2026

Merge activity

@graphite-app graphite-app bot force-pushed the 01-08-refactor_formatter_sort_imports_use_nodejs-built-in-modules_to_detect_builtin branch from 98120a9 to 23c27b6 Compare January 8, 2026 02:50
@graphite-app graphite-app bot merged commit 23c27b6 into main Jan 8, 2026
20 of 21 checks passed
@graphite-app graphite-app bot deleted the 01-08-refactor_formatter_sort_imports_use_nodejs-built-in-modules_to_detect_builtin branch January 8, 2026 02:56
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 8, 2026
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.

3 participants