Skip to content
This repository has been archived by the owner on Sep 30, 2020. It is now read-only.

feat!: enables sort-keys rule to make sure keys are sorted alphabetically in ascending order #63

Merged
merged 2 commits into from
Aug 12, 2019

Conversation

jbalsas
Copy link
Contributor

@jbalsas jbalsas commented Aug 12, 2019

This will be a breaking change as it will result in more errors. Right now, if applied to portal, we get:

✖ 150 problems (150 errors, 0 warnings)

index.js Outdated
@@ -30,6 +30,7 @@ const config = {
'object-shorthand': 'error',
'prefer-const': 'error',
'quote-props': ['error', 'as-needed'],
'sort-keys': ['error', 'asc', {caseSensitive: false}],
Copy link
Contributor

Choose a reason for hiding this comment

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

My only doubt is whether the Java sorting we do is case-insensitive too; if we do, then we should match that here, otherwise I'd say not. The thing I don't like about case-insensitive mode is that it isn't deterministic; ie. these are both valid:

const a = {
  a: 1,
  A: 1,
}

const b = {
  A: 1,
  a: 1,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Verified that Java sorting in portal seems to be "partially" insensitive in that this is the ordering I'm seeing:

fooa
fooA
fooa1
fooa11
fooa20
foob
fooB

@jbalsas
Copy link
Contributor Author

jbalsas commented Aug 12, 2019

Hey @wincent, I've checked Java sorting and added the result of my observation. I think there's some case sensitiveness built in, which is likely not 100% correct, but it is what it is.

It also looks like numbers are naturally sorted, so I've pushed an additional commit with that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants