[sort-keys] Add option to allow shorthand in object literals to be first/last
See original GitHub issuePlease 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:
- Created 7 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.