Skip to content

feat(linter/sort-keys): support autofix with comments#22061

Merged
camc314 merged 2 commits intooxc-project:mainfrom
Amund211:sort-keys-comments
May 4, 2026
Merged

feat(linter/sort-keys): support autofix with comments#22061
camc314 merged 2 commits intooxc-project:mainfrom
Amund211:sort-keys-comments

Conversation

@Amund211
Copy link
Copy Markdown
Contributor

@Amund211 Amund211 commented May 1, 2026

Note

This PR is completely AI-generated, and I have only briefly read through it to check that it looked sensible. Feel free to reject it if the code seems unmaintainable or poorly implemented :^)

Building on the work I did in #22052, I want to "re-activate" some autofixes for this rule. Specifically targetting js-doc and same-line, trailing // comments here as I feel pretty confident in attributing them to a specific property based on their position.

Leading /** ... */ comments attached to a property and trailing same-line ``// ...` comments are now absorbed into that property's lifted text during the autofix, so they travel with the key when it moves. Other comment kinds still cause the fix to bail out.

Leading `/** ... */` comments attached to a property and trailing
same-line ``// ...` comments are now absorbed into that property's
lifted text during the autofix, so they travel with the key when it
moves. Other comment kinds still cause the fix to bail out.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Amund211 Amund211 requested a review from camc314 as a code owner May 1, 2026 22:59
Comment thread crates/oxc_linter/src/snapshots/eslint_sort_keys.snap
Comment thread crates/oxc_linter/src/rules/eslint/sort_keys.rs
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 1, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing Amund211:sort-keys-comments (76945bd) with main (5b9ea93)

Open in CodSpeed

Footnotes

  1. 47 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
Copy Markdown
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

thank you!

@camc314 camc314 self-assigned this May 4, 2026
@camc314 camc314 added the A-linter Area - Linter label May 4, 2026
@camc314 camc314 merged commit 00f9a9d into oxc-project:main May 4, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants