-
-
Notifications
You must be signed in to change notification settings - Fork 7
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: Add sort-keys rule #76
base: main
Are you sure you want to change the base?
Conversation
2c210e9
to
d651aae
Compare
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! |
7d9916f
to
69211e8
Compare
0e6aac4
to
337dd83
Compare
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 <[email protected]>
Co-authored-by: Nicholas C. Zakas <[email protected]>
53b4cda
to
933539a
Compare
7cfda22
to
708311c
Compare
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
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