Rule Details

This rule enforces the use of the shorthand syntax. This applies
to all methods (including generators) defined on object literals and any
properties defined where the key name matches name of the assigned variable.

Each of the following properties would warn:

varfoo={x:function(){},y:function*(){},z:z};

In that case the expected syntax would have been:

varfoo={x(){},*y(){},y};

This rule does not flag arrow functions inside of object literals.
The following will not warn:

varfoo={x:(y)=>y};

Options

The rule takes an option which specifies when it should be applied. It can be set to
“always”, “properties”, “methods”, or “never”. The default is “always”.

"always" expects that the shorthand will be used whenever possible.

"methods" ensures the method shorthand is used (also applies to generators).

"properties ensures the property shorthand is used (where the key and variable name match).

"never" ensures that no property or method shorthand is used in any object literal.

You can set the option in configuration like this:

"object-shorthand":[2,"always"]

When Not To Use It

Anyone not yet in an ES6 environment would not want to apply this rule. Others may find the terseness of the shorthand
syntax harder to read and may not want to encourage it with this rule.