Skip to content
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

Update order-properties to use sort-package-json #55

Conversation

kendallgassner
Copy link
Collaborator

closes: #31

What

  • Replaced the order-properties sorting algorithm to use sort-package-json.
  • Changed the type of options from an Array<string> to
{
    order?: "legacy" | "sort-package-json" | Array<string>
}
  • defaulted the sort order to legacy
  • Add additional testing to test options: "legacy" | "sort-package-json" .

Callouts

Option: order: Array<string>

Previously, any property that was not provided in the order: Array<string> collection was ignored by the sort algorithm. Now that we are using sort-package-json, a property that is not provided in the order: Array<string> will be sorted by the defaultSortOrder provided by the library.

Sort-package-json version

the latest version of sort-package-json is an esm module so I opted to use an earlier version to avoid heavy refactorign. This package can be bumped when #33 is merged.

Copy link
Owner

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

D'oh! I don't know how this slipped by me - sorry for taking two weeks @kendallgassner!

Changes look great. Just a few small nits I can take care of. Will release soon. Thanks! 🚀

Person in sunglasses trying to be cool, fist bumping a fist that appears from stage right. Pixellated explosion ensues at the bump.

docs/rules/order-properties.md Outdated Show resolved Hide resolved
lib/rules/sort-collections.js Outdated Show resolved Hide resolved
@JoshuaKGoldberg JoshuaKGoldberg merged commit 6857660 into JoshuaKGoldberg:master Oct 17, 2023
1 check passed
@JoshuaKGoldberg
Copy link
Owner

Published as eslint-plugin-package-json@0.2.0.

Intentionally a different minor version than the previous 0.1.x line. I'll publish #40 and #58 in a new 0.3 line so folks can stick with this feature in case ESLint 8 support breaks them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

order-properties: consider an option for sort-package-json's order
2 participants