Skip to content

feat: implement useSortedEnumMembers#10000

Open
Netail wants to merge 2 commits intobiomejs:nextfrom
Netail:feat/sort-enums
Open

feat: implement useSortedEnumMembers#10000
Netail wants to merge 2 commits intobiomejs:nextfrom
Netail:feat/sort-enums

Conversation

@Netail
Copy link
Copy Markdown
Member

@Netail Netail commented Apr 15, 2026

Summary

Port sorting enums from several Eslint plugins for Graphql & TS

Related #9137 & #536

Test Plan

unit tests

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 4be897f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 14 packages
Name Type
@biomejs/biome Minor
@biomejs/cli-win32-x64 Minor
@biomejs/cli-win32-arm64 Minor
@biomejs/cli-darwin-x64 Minor
@biomejs/cli-darwin-arm64 Minor
@biomejs/cli-linux-x64 Minor
@biomejs/cli-linux-arm64 Minor
@biomejs/cli-linux-x64-musl Minor
@biomejs/cli-linux-arm64-musl Minor
@biomejs/wasm-web Minor
@biomejs/wasm-bundler Minor
@biomejs/wasm-nodejs Minor
@biomejs/backend-jsonrpc Patch
@biomejs/js-api Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added A-Project Area: project A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Diagnostic Area: diagnostocis labels Apr 15, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 15, 2026

Merging this PR will not alter performance

✅ 68 untouched benchmarks
⏩ 186 skipped benchmarks1


Comparing Netail:feat/sort-enums (4be897f) with next (308b559)

Open in CodSpeed

Footnotes

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

@Netail Netail marked this pull request as ready for review April 15, 2026 20:30
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 15, 2026

Walkthrough

Adds a new assist action useSortedEnumMembers for TypeScript and GraphQL: registers the action in the configuration enum, implements source rules that detect unsorted enum members and provide safe in-place fixes (TS and GraphQL), adds rule options type, and includes valid/invalid test fixtures for both languages.

Possibly related PRs

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main feature being added: implementing the useSortedEnumMembers rule across TypeScript and GraphQL.
Description check ✅ Passed The pull request description clearly relates to the changeset, describing the implementation of a useSortedEnumMembers rule for GraphQL and TypeScript.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/wise-beds-grow.md:
- Line 5: Update the changeset sentence to fix grammar and tighten wording:
replace “enums members” with “enum members” and rephrase the line to a concise,
past-tense release note such as "Added the new assist action
`useSortedEnumMembers`, which sorts TypeScript and GraphQL enum members." Ensure
the reference to the assist action `useSortedEnumMembers` remains and the
phrasing follows the 1–3 sentence guideline.

In `@crates/biome_js_analyze/src/assist/source/use_sorted_enum_members.rs`:
- Around line 133-146: The function is_enum_member_list_sorted keeps a
persistent prev key across members with None keys, causing comparisons to span
computed-name boundaries; update is_enum_member_list_sorted so that when
get_value_definition_key(&item) returns None you reset prev to None (treat None
as a group boundary) and only compare/assign prev when the key is Some; this
will align detection with the fixer behavior in sorted_separated_list_by and
prevent false diagnostics/fixes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 09a46395-d961-4afd-a919-73f9a7f32b6f

📥 Commits

Reviewing files that changed from the base of the PR and between 308b559 and 7ddf23a.

⛔ Files ignored due to path filters (7)
  • crates/biome_diagnostics_categories/src/categories.rs is excluded by !**/categories.rs and included by **
  • crates/biome_graphql_analyze/tests/specs/source/useSortedEnumMembers/invalid.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_graphql_analyze/tests/specs/source/useSortedEnumMembers/valid.graphql.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/source/useSortedEnumMembers/invalid.ts.snap is excluded by !**/*.snap and included by **
  • crates/biome_js_analyze/tests/specs/source/useSortedEnumMembers/valid.ts.snap is excluded by !**/*.snap and included by **
  • packages/@biomejs/backend-jsonrpc/src/workspace.ts is excluded by !**/backend-jsonrpc/src/workspace.ts and included by **
  • packages/@biomejs/biome/configuration_schema.json is excluded by !**/configuration_schema.json and included by **
📒 Files selected for processing (10)
  • .changeset/wise-beds-grow.md
  • crates/biome_configuration/src/analyzer/assist/actions.rs
  • crates/biome_graphql_analyze/src/assist/source/use_sorted_enum_members.rs
  • crates/biome_graphql_analyze/tests/specs/source/useSortedEnumMembers/invalid.graphql
  • crates/biome_graphql_analyze/tests/specs/source/useSortedEnumMembers/valid.graphql
  • crates/biome_js_analyze/src/assist/source/use_sorted_enum_members.rs
  • crates/biome_js_analyze/tests/specs/source/useSortedEnumMembers/invalid.ts
  • crates/biome_js_analyze/tests/specs/source/useSortedEnumMembers/valid.ts
  • crates/biome_rule_options/src/lib.rs
  • crates/biome_rule_options/src/use_sorted_enum_members.rs

Comment thread .changeset/wise-beds-grow.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Diagnostic Area: diagnostocis A-Linter Area: linter A-Project Area: project L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant