Skip to content

feat: implement autofix for sort-keys#216

Merged
mdjermanovic merged 4 commits intoeslint:mainfrom
sethamus:sort-keys-autofix
Mar 16, 2026
Merged

feat: implement autofix for sort-keys#216
mdjermanovic merged 4 commits intoeslint:mainfrom
sethamus:sort-keys-autofix

Conversation

@sethamus
Copy link
Copy Markdown
Contributor

Prerequisites checklist

AI acknowledgment

  • I did not use AI to generate this PR.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

What is the purpose of this pull request?

This PR adds autofix support to sort-keys so eslint can automatically reorder object keys, while avoiding fixes that could detach/misplace comments.

What changes did you make? (Give an overview)

  • Marked sort-keys as fixable and implemented a fixer that swaps out-of-order adjacent members.
  • Updated/added tests to assert autofix output across existing invalid cases

Related Issues

Fixes #122

Is there anything you'd like reviewers to focus on?

@lumirlumir lumirlumir moved this from Needs Triage to Implementing in Triage Feb 20, 2026
@nzakas
Copy link
Copy Markdown
Member

nzakas commented Mar 9, 2026

@sethamus there are some comments to review.

@DMartens DMartens moved this from Implementing to Second Review Needed in Triage Mar 14, 2026
@DMartens
Copy link
Copy Markdown

Changes LGTM, thanks. Would like someone else to double-check this as it is a feature.

DMartens
DMartens previously approved these changes Mar 14, 2026
Copy link
Copy Markdown
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

Just one suggestion about the test coverage, then LGTM.

Copy link
Copy Markdown
Member

@mdjermanovic mdjermanovic left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@mdjermanovic mdjermanovic merged commit 3534818 into eslint:main Mar 16, 2026
33 checks passed
@github-project-automation github-project-automation bot moved this from Second Review Needed to Complete in Triage Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

Rule Change: make sort-keys rule fixable

6 participants