-
-
Notifications
You must be signed in to change notification settings - Fork 760
feat(biome_js_analyze): implement useArraySortCompare #8065
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
Conversation
🦋 Changeset detectedLatest commit: e3ce923 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
WalkthroughAdds a new Project-domain lint rule Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-10-15T09:23:33.055ZApplied to files:
🧬 Code graph analysis (1)crates/biome_js_analyze/src/lint/nursery/use_array_sort_compare.rs (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
🔇 Additional comments (5)
Comment |
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.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (9)
crates/biome_cli/src/execute/migrate/eslint_any_rule_to_biome.rsis excluded by!**/migrate/eslint_any_rule_to_biome.rsand included by**crates/biome_configuration/src/analyzer/linter/rules.rsis excluded by!**/rules.rsand included by**crates/biome_configuration/src/generated/domain_selector.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_diagnostics_categories/src/categories.rsis excluded by!**/categories.rsand included by**crates/biome_js_analyze/src/lint/nursery.rsis excluded by!**/nursery.rsand included by**crates/biome_js_analyze/tests/specs/nursery/useArraySortCompare/invalid.ts.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/nursery/useArraySortCompare/valid.ts.snapis excluded by!**/*.snapand included by**packages/@biomejs/backend-jsonrpc/src/workspace.tsis excluded by!**/backend-jsonrpc/src/workspace.tsand included by**packages/@biomejs/biome/configuration_schema.jsonis excluded by!**/configuration_schema.jsonand included by**
📒 Files selected for processing (6)
.changeset/sad-adults-enjoy.md(1 hunks)crates/biome_js_analyze/src/lint/nursery/use_array_sort_compare.rs(1 hunks)crates/biome_js_analyze/tests/specs/nursery/useArraySortCompare/invalid.ts(1 hunks)crates/biome_js_analyze/tests/specs/nursery/useArraySortCompare/valid.ts(1 hunks)crates/biome_rule_options/src/lib.rs(1 hunks)crates/biome_rule_options/src/use_array_sort_compare.rs(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/biome_module_graph/src/**/*.rs : Do not copy or clone data between module graph entries (including behind Arc). Each module must avoid holding duplicated data from another module to enable simple invalidation.
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/**/*.rs : After generation, remove usages of `format_verbatim_node` and implement real formatting with biome_formatter utilities
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/lib.rs : Add the provided AsFormat, IntoFormat, and iterator plumbing code to lib.rs
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/{type_info,local_inference,resolver,flattening}.rs : Avoid recursive type structures and cross-module Arcs; represent links between types using TypeReference and TypeData::Reference.
Applied to files:
crates/biome_rule_options/src/lib.rs
📚 Learning: 2025-10-15T09:23:33.055Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_type_info/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:23:33.055Z
Learning: Applies to crates/biome_js_type_info/src/type_info.rs : Add new TypeScript type support by extending the TypeData enum rather than introducing parallel structures.
Applied to files:
crates/biome_rule_options/src/use_array_sort_compare.rscrates/biome_js_analyze/src/lint/nursery/use_array_sort_compare.rs
🧬 Code graph analysis (2)
crates/biome_rule_options/src/use_array_sort_compare.rs (1)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (1)
UseArraySortCompareOptions(8376-8376)
crates/biome_js_analyze/src/lint/nursery/use_array_sort_compare.rs (1)
packages/@biomejs/backend-jsonrpc/src/workspace.ts (2)
RuleDomain(927-935)UseArraySortCompareOptions(8376-8376)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
- GitHub Check: Documentation
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: End-to-end tests
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check Dependencies
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Check JS Files
- GitHub Check: Bench (biome_js_analyze)
- GitHub Check: autofix
- GitHub Check: Bench (biome_js_parser)
- GitHub Check: Bench (biome_js_formatter)
- GitHub Check: Bench (biome_configuration)
crates/biome_js_analyze/src/lint/nursery/use_array_sort_compare.rs
Outdated
Show resolved
Hide resolved
| const anyArray: any[] = []; | ||
| anyArray.sort(); | ||
| anyArray.toSorted(); | ||
|
|
||
| const stringArray: string[] = []; | ||
| stringArray.sort(); | ||
| stringArray.toSorted(); |
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.
Add coverage for explicit default comparators.
Please include array.sort(undefined), array.sort(null), and the toSorted equivalents here. The source rule we're porting flags those usages because they still fall back to the lexicographic default, so we need fixtures to lock that behaviour in.
🤖 Prompt for AI Agents
In crates/biome_js_analyze/tests/specs/nursery/useArraySortCompare/invalid.ts
around lines 1-7, the test file is missing cases that call the default
comparator explicitly; add calls that exercise the explicit default comparator
by invoking anyArray.sort(undefined), anyArray.sort(null),
anyArray.toSorted(undefined), anyArray.toSorted(null) and likewise
stringArray.sort(undefined), stringArray.sort(null),
stringArray.toSorted(undefined), stringArray.toSorted(null) so the fixture locks
the lexicographic fallback behavior for both any[] and string[] variants.
CodSpeed Performance ReportMerging #8065 will not alter performanceComparing Summary
Footnotes
|
crates/biome_js_analyze/src/lint/nursery/use_array_sort_compare.rs
Outdated
Show resolved
Hide resolved
d3cf2c7 to
f0c16ae
Compare
f0c16ae to
e3ce923
Compare
Summary
Implement Eslint's
useArraySortCompareCloses #8061
Test Plan
Docs