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
New: sort-keys
rule (fixes #6076)
#6800
Conversation
@mysticatea, thanks for your PR! By analyzing the annotation information on this pull request, we identified @nzakas, @cschuller and @aubergine10 to be potential reviewers |
Thanks for the pull request, @mysticatea! I took a look to make sure it's ready for merging and found some changes are needed:
Can you please update the pull request to address these? (More information can be found in our pull request guide.) |
Thanks for the pull request, @mysticatea! I took a look to make sure it's ready for merging and found some changes are needed:
Can you please update the pull request to address these? (More information can be found in our pull request guide.) |
Thanks for the pull request, @mysticatea! I took a look to make sure it's ready for merging and found some changes are needed:
Can you please update the pull request to address these? (More information can be found in our pull request guide.) |
The last commit has |
|
||
The 2nd option is an object which has 2 properties. | ||
|
||
* `insensitive` - if `true`, enforce properties to be in case-insensitive order. Default is `false`. |
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.
Can this be sensitive
so it's not a negated term?
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.
Or maybe caseSensitive
for clarity?
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.
Hmm, in that case, is the default behavior below or both false
?
{
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": false}]
}
@markelog @mdevils @mikesherov can you guys look this over to compare with JSCS rule? |
LGTM |
I just updated an option: |
LGTM |
Rebased for #6870. |
LGTM |
Fixes #6076.
This PR adds
sort-keys
rule.props
option tono-self-assign
rule (fixes #6718) #6721. This commit addsastUtils.getStaticPropertyName
function.sort-keys
implement sorts simple computed properties (e.g.,let obj = {a: 1, [b]: 2}
) similar to JSCS. This would help a use of symbols.sort-keys
implement ignores non-simple computed properties (e.g.,let obj = {a: 1, [b + c]: 2}
).natural-compare
, JSCS are using.