Skip to content

Comments

feat(oxfmt/sort_package_json): Handle oxfmtrc.sort_scripts option#17738

Merged
graphite-app[bot] merged 1 commit intomainfrom
01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option
Jan 7, 2026
Merged

feat(oxfmt/sort_package_json): Handle oxfmtrc.sort_scripts option#17738
graphite-app[bot] merged 1 commit intomainfrom
01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Jan 7, 2026

Part of #17387

This PR does not affect existing behavior. The next PR will implement the integration and tests.

Copilot AI review requested due to automatic review settings January 7, 2026 06:55
@leaysgur leaysgur requested a review from Dunqing as a code owner January 7, 2026 06:55
@github-actions github-actions bot added A-formatter Area - Formatter C-enhancement Category - New feature or request labels Jan 7, 2026
Copy link
Member Author

leaysgur commented Jan 7, 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.

@leaysgur leaysgur force-pushed the 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option branch from 757cb00 to c7c4cdd Compare January 7, 2026 06:59
@github-actions github-actions bot added the A-cli Area - CLI label Jan 7, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Jan 7, 2026

CodSpeed Performance Report

Merging this PR will not alter performance

Comparing 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option (22a1693) with main (c115f4e)1

Summary

✅ 42 untouched benchmarks
⏩ 3 skipped benchmarks2

Footnotes

  1. No successful run was found on 01-07-fix_tasks_website_handle_nested_refs_correctly (5c89e39) during the generation of this report, so main (c115f4e) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 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.

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 adds support for a sortScripts configuration option to the package.json sorting feature. The configuration changes from a simple boolean to a flexible enum that can accept either a boolean (for backwards compatibility) or an object with granular options.

  • Introduces SortPackageJsonConfig struct with sortScripts option (default: false)
  • Creates SortPackageJsonUserConfig enum to support both boolean and object configuration formats
  • Updates JSON schemas and snapshots to reflect the new configuration structure

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
npm/oxfmt/configuration_schema.json Adds JSON schema definitions for SortPackageJsonConfig and SortPackageJsonUserConfig, updates experimentalSortPackageJson to use the new union type
crates/oxc_formatter/tests/snapshots/schema_json.snap Updates snapshot test to reflect schema changes
crates/oxc_formatter/src/oxfmtrc.rs Implements new configuration types, changes OxfmtOptions.sort_package_json from bool to Option<sort_package_json::SortOptions>
crates/oxc_formatter/Cargo.toml Adds sort-package-json dependency
Cargo.lock Updates lock file with new dependency

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

@leaysgur leaysgur force-pushed the 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option branch from c7c4cdd to adf8f9b Compare January 7, 2026 07:09
@leaysgur leaysgur changed the base branch from main to graphite-base/17738 January 7, 2026 07:13
@leaysgur leaysgur force-pushed the 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option branch from adf8f9b to 8e92e1b Compare January 7, 2026 07:13
@leaysgur leaysgur changed the base branch from graphite-base/17738 to 01-07-fix_tasks_website_handle_nested_refs_correctly January 7, 2026 07:13
@leaysgur leaysgur force-pushed the 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option branch 2 times, most recently from 34f6c60 to 8fea6c0 Compare January 7, 2026 07:18
@leaysgur leaysgur force-pushed the 01-07-fix_tasks_website_handle_nested_refs_correctly branch from 1902a86 to 5c89e39 Compare January 7, 2026 07:23
@leaysgur leaysgur force-pushed the 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option branch from 8fea6c0 to 22a1693 Compare January 7, 2026 07:23
@leaysgur leaysgur changed the title feat(oxfmt/sort_package_json): Handle sort_scripts option feat(oxfmt/sort_package_json): Handle oxfmtrc.sort_scripts option Jan 7, 2026
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Jan 7, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Jan 7, 2026

Merge activity

…17738)

Part of #17387

This PR does not affect existing behavior. The next PR will implement the integration and tests.
graphite-app bot pushed a commit that referenced this pull request Jan 7, 2026
@graphite-app graphite-app bot force-pushed the 01-07-fix_tasks_website_handle_nested_refs_correctly branch from 5c89e39 to 9523203 Compare January 7, 2026 08:03
@graphite-app graphite-app bot force-pushed the 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option branch from 22a1693 to 86c0168 Compare January 7, 2026 08:03
Base automatically changed from 01-07-fix_tasks_website_handle_nested_refs_correctly to main January 7, 2026 08:08
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 7, 2026
@graphite-app graphite-app bot merged commit 86c0168 into main Jan 7, 2026
22 checks passed
@graphite-app graphite-app bot deleted the 01-07-feat_oxfmt_sort_package_json_handle_sort_scripts_option branch January 7, 2026 08:10
Dunqing pushed a commit that referenced this pull request Jan 12, 2026
# Oxlint
### 🚀 Features

- 9699a1b linter/prefer-global-this: Add suggestion (#17873) (Mikhail
Baev)
- 51c2815 linter/no-invalid-regexp: Add labels and help text to flag
diagnostics (#17865) (camchenry)
- 344d77d linter/no-ex-assign: Improve diagnostic with more detail
(#17864) (camchenry)
- 7d280e0 linter: Add fixer for
`unicorn/no-useless-error-capture-stack-trace` rule (#17839) (Mikhail
Baev)
- af1d0e3 linter/prefer-optional-chain: Add rule (#17831) (camc314)
- e3c4108 vscode: Add more supported languages to extension (#17812)
(Alexander Lichter)
- 4a46678 vscode: Activate extension on more languages (#17717) (Sysix)
- b1298fc vscode: Sync formatter with supported files (#17615)
(Alexander Lichter)
- c7f0848 linte/rno-required-prop-with-default: Implement suggestion
(#17747) (Minsu Lee)
- 0e8127e linter/vue: Implement no-lifecycle-after-await (#17701)
(yefan)
- 3567304 linter/vitest: Implement `consistent-each-for` (#17601) (Said
Atrahouch)
- 883e156 linter: Add fixer for `unicorn/no-useless-collection-argument`
rule (#17594) (Mikhail Baev)
- 4eb335c linter/vitest: Implemented prefer-called-once (#17674) (Said
Atrahouch)
- 2bd2d5a linter/vitest: Implement hoisted-apis-on-top (#17658) (Said
Atrahouch)
- cfb2bcc linter/vue: Implement no-arrow-functions-in-watch (#17672)
(yefan)
- a68208a linter/eslint-plugin-vitest: Implements
`prefer-describe-function-title` (#17677) (Said Atrahouch)
- efa029f linter/vitest: Implement no-unneeded-async-expect-function
(#17494) (Minsu Lee)

### 🐛 Bug Fixes

- 49cf66e lsp: Fix workspace worker selection for nested and
similar-named workspaces (#17853) (Copilot)
- 84f4f3c linter: Add doc url for tsgolint diagnostics (#17879) (Sysix)
- 76c903f linter/consistent-indexed-object-style: Skip fixing default
exported interface (#17874) (Copilot)
- 7e87d16 linter/tabindex-no-positive: Improve diagnostic phrasing
(#17849) (connorshea)
- 28f9fba vscode: Fix nested search for binaries (#17832) (Sysix)
- 8ca2cd2 linter: Move jsx-a11y/no-static-element-interactions rule to
nursery. (#17818) (connorshea)
- dc9fdd6 linter/consistent-indexed-object-style: Re-port test cases and
fix some bugs (#17802) (camc314)
- 7bbd880 linter: Update prefer-destructuring rule metadata (#17642)
(Hamir Mahal)
- 3c45185 linter/consistent-indexed-object-style: False positive with
circular reference (#17789) (heygsc)
- bd186b4 vscode: Search for `oxlint` and `oxfmt` in every workspace
directory (#17760) (Sysix)
- 3e0dff7 linter/no-hooks: Add punctuation to diagnostic message
(#17751) (camc314)
- 6ae21f9 linter/prefer-called-once: Avoid panic on trailing comma
(#17735) (Said Atrahouch)
- 32c3901 oxlint: Do not panic on invalid `no-unused-vars` configuration
(#17719) (Sysix)
- 59a6228 parser: Detect TS1363 error for type-only imports with mixed
default and named/namespace bindings (#17712) (Copilot)

### ⚡ Performance

- f87a1e2 linter: Check for giving reserved plugin name before calling
`load_plugin` on napi side (#17841) (Sysix)

### 📚 Documentation

- a2b3a24 linter/no-caller: Improve docs and diagnostic for rule.
(#17890) (connorshea)
- aa48247 linter/no-unsafe-finally: Improve rule docs. (#17891)
(connorshea)
- 1b0bdee linter: Tweak docs for no-useless-constructor and
hoisted-apis-on-top (#17888) (connorshea)
- 8f24fa9 vscode: Remove mention of a built-in server (#17836) (Sysix)
- e81a306 linter: Update the tsconfig flag mention for the import
plugin. (#17778) (connorshea)
# Oxfmt
### 🚀 Features

- 539b350 formatter/sort_imports: Update `NODE_BUILTINS` modules
(#17771) (nilptr)
- 2e03ebf oxfmt/lsp: Use `SourceFormatter` to support non-JS files and
napi features (#17655) (leaysgur)
- 623f7eb oxfmt/sort_package_json: Use `options.sort_scripts` (#17740)
(leaysgur)
- 86c0168 oxfmt/sort_package_json: Handle `oxfmtrc.sort_scripts` option
(#17738) (leaysgur)
- 256636a oxfmt/lsp: Add `.editorconfig` to `get_watcher_patterns`
(#17694) (leaysgur)
- 3f3db39 oxfmt/lsp: Use `ConfigResolver` to align with CLI (#17654)
(leaysgur)

### 🐛 Bug Fixes

- fdd1e1e formatter: Don't wrap parenthesis for type assertion when it's
an declaration of export default (#17878) (Dunqing)
- f0813ad formatter: Incorrect type annotation check for short argument
(#17877) (Dunqing)
- 9e89389 formatter/tailwindcss: Nested class string doesn't respect
`singleQuote: true` (#17838) (Dunqing)
- e2f534c formatter/sort_imports: Handle alignable comment with JsLabels
(#17791) (leaysgur)
- f0cedd4 formatter/tailwindcss: Class name is broken after sorting when
its contains single quotes with `singleQuote: true` (#17790) (Dunqing)
- 1864142 oxfmt/tailwindcss: Bundle `prettier/plugins/*` (#17782)
(leaysgur)
- 3a9d43b oxfmt: Ignore explicit positional path which is ignored by
directory (#17732) (leaysgur)
- 0563217 formatter: Classes will be stripped out when both
`experimentalTailwindcss` and `experimentalSortImports` are enabled
(#17726) (Dunqing)

### ⚡ Performance

- d1bc514 formatter: Optimize RegExpLiteral formatting to avoid heap
allocations (#17797) (Dunqing)

### 📚 Documentation

- 62b7a01 formatter: Clarify `experimentalTailwindcss` configuration
comments (#17898) (Dunqing)

Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-formatter Area - Formatter C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants