-
-
Notifications
You must be signed in to change notification settings - Fork 12
feat: Add sort-keys rule #76
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks good. I left some comments to clean things up.
Also, please add the rule to the rules list in README.md
.
Think I addressed all feedback. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a bit of README cleanup but otherwise LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like @mdjermanovic to review before merging.
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
Co-authored-by: Nicholas C. Zakas <nicholas@humanwhocodes.com>
tests/rules/sort-keys.test.js
Outdated
`, | ||
language: "json/jsonc", | ||
options: ["asc", { allowLineSeparatedGroups: true }], | ||
languageOptions: { ecmaVersion: 6 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
languageOptions: { ecmaVersion: 6 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 765cbde That was left over from copying from eslint/sort-keys
tests/rules/sort-keys.test.js
Outdated
`, | ||
language: "json/jsonc", | ||
options: ["asc", { allowLineSeparatedGroups: true }], | ||
languageOptions: { ecmaVersion: 6 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
languageOptions: { ecmaVersion: 6 }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated 765cbde
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for contributing!
Prerequisites checklist
What is the purpose of this pull request?
Adds a
sort-keys
rule for JSON that mimics the functionality of the existingsort-keys
for JS.What changes did you make? (Give an overview)
Added a
sort-keys
rule and tests.Related Issues
Fixes #75
Is there anything you'd like reviewers to focus on?
I started by copying over the existing code for JS
sort-keys
, but it required some big modifications in order to work on JSON. It would be nice if there was an automated way to make sure thissort-keys
maintains parity with thatsort-keys
to keep things consistent across ESLint packages, but JS and JSON are different enough that I'm not sure how it could be done.json/tests/rules/sort-keys.test.js
Line 2 in 7fe2782
Note that I added a TODO for how comments affect line-separated groups