Skip to content

refactor(useSortedKeys): transfer trailing separator upon sorting #6587

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

Merged
merged 7 commits into from
Jun 27, 2025

Conversation

Conaclos
Copy link
Member

@Conaclos Conaclos commented Jun 27, 2025

Summary

Fix #6491

I moved ComparableToken to biome_string_case and utilities related to separated list sorting to biome_analyze.
I am quite satisfied of these utilities that will allow us to easily implement rules for sorting separated list.
I didn't take a look at useSortedAttributes. I left it for a future PR.

We now avoid allocation on the happy path (when everything is already sorted).

Also, I improved the diagnostics, and we now emit a single diagnostic for a given object.

Test Plan

I added tests.

Copy link

changeset-bot bot commented Jun 27, 2025

🦋 Changeset detected

Latest commit: eb541de

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

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

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

@Conaclos Conaclos changed the title Conaclos/use sorted keys6491 refactor(useSortedKeys): transfer trailing separator upon sorting Jun 27, 2025
@github-actions github-actions bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages labels Jun 27, 2025
@Conaclos Conaclos requested review from a team June 27, 2025 10:03
Copy link

codspeed-hq bot commented Jun 27, 2025

CodSpeed Performance Report

Merging #6587 will improve performances by 9.08%

Comparing conaclos/useSortedKeys6491 (eb541de) with main (153eda7)

Summary

⚡ 1 improvements
✅ 114 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
json_analyzer[package-lock_11240515041603712709.json] 26.2 ms 24 ms +9.08%

@github-actions github-actions bot added the A-CLI Area: CLI label Jun 27, 2025

# Diagnostics
```
issue-5710.js:2:1 assist/source/organizeImports FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a little improvement over the previous implementation :)

Copy link
Member

@ematipico ematipico Jun 27, 2025

Choose a reason for hiding this comment

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

If there's an improvement, we should add a changeset for it. It's always good to tell users stuff

Copy link
Member Author

Choose a reason for hiding this comment

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

This is really edgy: you have to have buggy nodes like here where specifiers are duplicated.

Copy link
Member

@ematipico ematipico Jun 27, 2025

Choose a reason for hiding this comment

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

I think we did this in the past, where we fixed (and emitted diagnostics) from broken nodes, rather than panicking. It's still a good improvement for the DX, even when it's an edge case. But I won't block the PR for it, it's your call :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done :)

@github-actions github-actions bot added the A-LSP Area: language server protocol label Jun 27, 2025
@Conaclos Conaclos force-pushed the conaclos/useSortedKeys6491 branch from 7db0ed5 to 9a9b2fd Compare June 27, 2025 11:52
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Great improvements!

@Conaclos Conaclos merged commit a330fcc into main Jun 27, 2025
28 checks passed
@Conaclos Conaclos deleted the conaclos/useSortedKeys6491 branch June 27, 2025 12:46
@github-actions github-actions bot mentioned this pull request Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-CLI Area: CLI A-Linter Area: linter A-LSP Area: language server protocol L-JavaScript Language: JavaScript and super languages L-JSON Language: JSON and super languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 useSortedKeys issues with in-line comments
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy