Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Enforce usage of object literal property value shorthand syntax #304

Closed
derekcicerone-zz opened this issue Feb 10, 2015 · 7 comments
Closed

Comments

@derekcicerone-zz
Copy link
Contributor

See: http://ariya.ofilabs.com/2013/02/es6-and-object-literal-property-value-shorthand.html

@adidahiya
Copy link
Contributor

+1 for a new rule that enforces this. It could be called object-literal-shorthand?

@ashwinr
Copy link
Contributor

ashwinr commented Jun 24, 2015

👍 to both the rule and the name

@adidahiya
Copy link
Contributor

We have another rule that operates on object literals called sort-object-literal-keys.
Perhaps that rule should be renamed to object-literal-sorted-keys to match this name?

@ashwinr
Copy link
Contributor

ashwinr commented Jun 24, 2015

sounds unnecessarily verbose.

@ashwinr
Copy link
Contributor

ashwinr commented Jun 24, 2015

actually, no. you're right, let's do that. I think object-literal-sort-keys

@adidahiya
Copy link
Contributor

This rule should also handle functions in object literals.

good:

const iterableThing = {
    [Symbol.iterator]() {
        ...
    },
    next() {
        ...
    }
}

bad:

const iterableThing = {
    [Symbol.iterator]: function () {
        ...
    },
    next: function () {
        ...
    }
}

@danvk
Copy link
Contributor

danvk commented Aug 15, 2016

This is object-shorthand in eslint: http://eslint.org/docs/rules/object-shorthand

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

No branches or pull requests

4 participants