Skip to content

feat(sort-keys): add allowLineSeparatedGroups option - #3084

Merged
FloEdelmann merged 10 commits into
vuejs:masterfrom
rodindev:feat/sort-keys-allow-line-separated-groups
Jun 8, 2026
Merged

FloEdelmann merged 10 commits into
vuejs:masterfrom
rodindev:feat/sort-keys-allow-line-separated-groups

Conversation

@rodindev

Copy link
Copy Markdown
Contributor

Closes #2212

Adds an allowLineSeparatedGroups option to vue/sort-keys, mirroring the ESLint core option of the same name.
When enabled, a blank line between properties resets the sort order, so each group is sorted independently.
Default false, so existing behavior is unchanged.

Test cases are ported from ESLint core's suite.

@changeset-bot

changeset-bot Bot commented May 31, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 1c8b5ff

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

This PR includes changesets to release 1 package
Name Type
eslint-plugin-vue Minor

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

@ota-meshi ota-meshi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for this PR!

Comment thread lib/rules/sort-keys.js Outdated
Comment thread lib/rules/sort-keys.js

@ota-meshi ota-meshi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! Thank you!

@ota-meshi
ota-meshi requested review from FloEdelmann and waynzh June 4, 2026 05:58

@FloEdelmann FloEdelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! I only have some suggestions for minor code style improvements.

Comment thread .changeset/sort-keys-allow-line-separated-groups.md Outdated
Comment thread lib/rules/sort-keys.js Outdated
Comment thread lib/rules/sort-keys.js Outdated
rodindev and others added 3 commits June 4, 2026 13:58
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>
Comment thread lib/rules/sort-keys.js Outdated
Co-authored-by: Flo Edelmann <git@flo-edelmann.de>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds the allowLineSeparatedGroups option to vue/sort-keys, aligning behavior with ESLint core: when enabled, a blank line between properties resets the sort order so each group is sorted independently (default remains false).

Changes:

  • Extend vue/sort-keys rule implementation to detect blank-line-separated property groups and reset ordering when configured.
  • Add valid/invalid test cases (ported from ESLint core) to cover the new option’s behavior.
  • Update rule documentation and add a changeset entry for the new option.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
lib/rules/sort-keys.js Implements allowLineSeparatedGroups by detecting blank lines between properties and resetting ordering per group.
tests/lib/rules/sort-keys.test.ts Adds coverage for the new option across various syntax patterns (comments, methods, computed keys, spreads, Vue SFC context).
docs/rules/sort-keys.md Documents the new option and updates the options list/example config.
.changeset/sort-keys-allow-line-separated-groups.md Records the feature as a minor release change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/rules/sort-keys.js

@FloEdelmann FloEdelmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@FloEdelmann
FloEdelmann merged commit eacb5fe into vuejs:master Jun 8, 2026
18 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 8, 2026
@rodindev
rodindev deleted the feat/sort-keys-allow-line-separated-groups branch June 9, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FR: introduce allowLineSeperatedGroups option on sort-keys

4 participants