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.

[sort-keys] Add option to allow shorthand in object literals to be first/last

See original GitHub issue

Please show your configuration:

'sort-keys': 'error',

What did you do? Please include the actual source code causing the issue.

export const ActiveRoute = {
  config,
  registerRouter,
  name: isActiveRouteName,
  path: isActiveRoutePath,
};

What did you expect to happen?

I’d expect this not to error out as I prefer to have shorthand assignments before regular assignment, but I’d like them sorted.

What actually happened? Please include the actual, raw output from ESLint.

Expected object keys to in natural insensitive ascending order. 'name' shoud be before 'registerRouter'.`

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
zimmecommented, Nov 13, 2016

I think just grouping and sorting shorthands separately is a good enough start.

However I would really love to be able to enforce that shorthands always come before regular members.

0reactions
nzakascommented, Dec 28, 2016

Unfortunately, it looks like consensus couldn’t be reached on this issue and so I’m closing it. While we wish we’d be able to accommodate everyone’s requests, we do need to prioritize. We’ve found that issues failing to reach consensus after 21 days tend never to reach consensus, and as such, we close those issues. This doesn’t mean the idea isn’t interesting, just that it’s not something the team can commit to.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
object-shorthand - ESLint - Pluggable JavaScript Linter
This rule enforces the use of the shorthand syntax. This applies to all methods (including generators) defined in object literals and any properties...
Read more >
14. New OOP features besides classes - Exploring JS
Property value shorthands let you abbreviate the definition of a property in an object ... In object literals, you only have option #1...
Read more >
Self-references in object literals / initializers - Stack Overflow
(Felix's is particularly clever, but requires creating and destroying a temporary function, adding complexity; and either leaves an extra property on the object...
Read more >
Object Literals Using Object Property Shorthand
Let's imagine we are writing a program that required us to model some data about some clothing. To do this we may use...
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