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

feat: sort-order rule shouldn't change sub-keys, better auto-fix #312

Merged
merged 5 commits into from
Apr 29, 2024

Conversation

hyoban
Copy link
Contributor

@hyoban hyoban commented Apr 13, 2024

PR Checklist

Overview

@hyoban hyoban changed the title fix: sort-order rule don't change sub-keys fix: sort-order rule shouldn't change sub-keys Apr 26, 2024
@hyoban hyoban marked this pull request as ready for review April 26, 2024 05:18
@hyoban
Copy link
Contributor Author

hyoban commented Apr 27, 2024

@JoshuaKGoldberg Sorry for the direct ping, I don't want you to miss this one. Please feel free to review it when you have time.

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.

This looks great, thanks! Just the one testing request. 🚀

Also - I think this is a big enough change (new dependencies, better auto-fix) that even though it's technically a bugfix, I'd like it to give it as a minor release rather than a patch. Renaming to feat: ....

Copy link
Owner

Choose a reason for hiding this comment

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

[Testing] Could you add a valid case where the top-level keys are sorted but sub-keys aren't? That way we know the logic is still just looking at the top-level keys.

return fixer.replaceText(
context.sourceCode.ast,
JSON.stringify(orderedSource, null, 2) +
`\n`,
result,
Copy link
Owner

Choose a reason for hiding this comment

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

[Praise] Nice, this results in better-preserved formatting for all auto-fixes!

@JoshuaKGoldberg
Copy link
Owner

Thanks for the ping! I've been in and out of being swamped with ESLint v9 / typescript-eslint v8 work, just emerging from that cocoon now. 😄

@JoshuaKGoldberg JoshuaKGoldberg added the status: waiting for author Needs an action taken by the original poster label Apr 28, 2024
@hyoban hyoban changed the title fix: sort-order rule shouldn't change sub-keys feat: sort-order rule shouldn't change sub-keys, better auto-fix Apr 29, 2024
@hyoban hyoban requested a review from JoshuaKGoldberg April 29, 2024 01:40
@github-actions github-actions bot removed the status: waiting for author Needs an action taken by the original poster label Apr 29, 2024
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.

A bunch of triumphant Mets players cheering while one guy in particular is whooping and walking

@JoshuaKGoldberg JoshuaKGoldberg merged commit a894550 into JoshuaKGoldberg:main Apr 29, 2024
15 checks passed
Copy link

🎉 This is included in version v0.13.0 🎉

The release is available on:

Cheers! 📦🚀

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.

🐛 Bug: package-json/order-properties changes scripts keys
2 participants