question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `allowLineSeparatedGroups` option to `sort-keys` rule

See original GitHub issue

What rule do you want to change? sort-keys

Does this change cause the rule to produce more or fewer warnings? No changes, if the allowLineSeparatedGroups parameter is false or omitted, or fewer warnings if it is true.

How will the change be implemented? (New option, new default behavior, etc.)? Add a new allowLineSeparatedGroups option, following the pattern of the tslint’s object-literal-sort-keys rule.

Please provide some example code that this change will affect:

const person = {
  firstName: 'Nico',
  lastName: 'Greenarry',

  hobbies: ['cats', 'dodgeball', 'potlucks'],
};

What does the rule currently do for this code?

ESLint: Expected object keys to be in ascending order. ‘hobbies’ should be before ‘lastName’. (sort-keys)

What will the rule do after it’s changed? If the allowLineSeparatedGroups option is true, then there would be no eslint exception.

Are you willing to submit a pull request to implement this change? Yes. I haven’t looked at the eslint codebase before, so I expect there to be a learning curve, but I’m willing to figure out how to implement it properly.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:14
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
kaicataldocommented, Jan 10, 2020

@nicogreenarry In recent times I think we’ve trended towards longer, more explicit option names 😃 Do you mind updating the proposal with allowLineSeparatedGroups?

@g-plane I’ll champion. We just need one more supporter.

1reaction
JJoGeoncommented, Aug 6, 2020

Agree with the proposal too. @nicogreenarry If you don’t mind, can I work on this issue? I’m new here and I’m looking for something to contribute. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

sort-keys - ESLint - Pluggable JavaScript Linter
This rule checks all property definitions of object expressions and verifies that all variables are sorted alphabetically. Examples of incorrect code for this ......
Read more >
object-literal-sort-keys - Rule
Rule : object-literal-sort-keys. Checks ordering of keys in object literals. When using the default alphabetical ordering, additional blank lines may be used ...
Read more >
Update ESLint and related (!93593) · Merge requests · GitLab.org ...
... c461542 feat: add new allowLineSeparatedGroups option to the sort-keys rule (#​16138) (Nitin Kumar); 1cdcbca feat: add deprecation warnings for legacy ...
Read more >
eslint-plugin-sort-keys-custom-order-fix - npm
Fork of eslint rule that sorts keys in objects (https://eslint.org/docs/rules/sort-keys) with a custom order and autofix enabled.
Read more >
eslint - Awesome JS
34c05a7 docs: Language Options page intro and tweaks (#16511) (Ben ... add new allowLineSeparatedGroups option to the sort-keys rule (#16138) (Nitin Kumar) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found