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

New: sort-keys rule (fixes #6076) #6800

Merged
merged 1 commit into from Aug 11, 2016
Merged

New: sort-keys rule (fixes #6076) #6800

merged 1 commit into from Aug 11, 2016

Conversation

mysticatea
Copy link
Member

@mysticatea mysticatea commented Jul 30, 2016

Fixes #6076.

This PR adds sort-keys rule.

  • This PR is sharing 1st commit d02e595 with Update: add props option to no-self-assign rule (fixes #6718) #6721. This commit adds astUtils.getStaticPropertyName function.
  • This 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.
  • This sort-keys implement ignores non-simple computed properties (e.g., let obj = {a: 1, [b + c]: 2}).
  • I ported most tests from JSCS.
  • I added a dependency, natural-compare, JSCS are using.

@mention-bot
Copy link

@mysticatea, thanks for your PR! By analyzing the annotation information on this pull request, we identified @nzakas, @cschuller and @aubergine10 to be potential reviewers

@eslintbot
Copy link

Thanks for the pull request, @mysticatea! I took a look to make sure it's ready for merging and found some changes are needed:

  • Pull requests with code require an issue to be mentioned at the end of the commit summary, such as (fixes #1234). Please update the commit summary with an issue (file a new issue if one doesn't already exist).

Can you please update the pull request to address these?

(More information can be found in our pull request guide.)

@eslintbot
Copy link

Thanks for the pull request, @mysticatea! I took a look to make sure it's ready for merging and found some changes are needed:

  • Pull requests with code require an issue to be mentioned at the end of the commit summary, such as (fixes #1234). Please update the commit summary with an issue (file a new issue if one doesn't already exist).

Can you please update the pull request to address these?

(More information can be found in our pull request guide.)

@eslintbot
Copy link

Thanks for the pull request, @mysticatea! I took a look to make sure it's ready for merging and found some changes are needed:

  • Pull requests with code require an issue to be mentioned at the end of the commit summary, such as (fixes #1234). Please update the commit summary with an issue (file a new issue if one doesn't already exist).

Can you please update the pull request to address these?

(More information can be found in our pull request guide.)

@mysticatea
Copy link
Member Author

The last commit has (fixes #6076).


The 2nd option is an object which has 2 properties.

* `insensitive` - if `true`, enforce properties to be in case-insensitive order. Default is `false`.
Copy link
Member

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?

Copy link
Member

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?

Copy link
Member Author

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}]
}

@nzakas
Copy link
Member

nzakas commented Aug 2, 2016

@markelog @mdevils @mikesherov can you guys look this over to compare with JSCS rule?

@eslintbot
Copy link

LGTM

@mysticatea
Copy link
Member Author

I just updated an option: insensitivecaseSensitive

@eslintbot
Copy link

LGTM

@mysticatea
Copy link
Member Author

Rebased for #6870.

@nzakas
Copy link
Member

nzakas commented Aug 11, 2016

LGTM

@nzakas nzakas merged commit e456fd3 into master Aug 11, 2016
@mysticatea mysticatea deleted the issue6076 branch August 13, 2016 23:29
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants