Rule: object-literal-shorthand
Enforces/disallows use of ES6 object literal shorthand.
Notes:
Has Fixer
Config
"always"
assumed to be default option, thus with no options provided
the rule enforces object literal methods and properties shorthands.
With "never"
option provided, any shorthand object literal syntax causes an error.
The rule can be configured in a more granular way.
With {"property": "never"}
provided (which is equivalent to {"property": "never", "method": "always"}
),
the rule only flags property shorthand assignments,
and respectively with {"method": "never"}
(equivalent to {"property": "always", "method": "never"}
),
the rule fails only on method shorthands.
Config examples
"object-literal-shorthand": true
"object-literal-shorthand": [true, "never"]
"object-literal-shorthand": [true, {"property": "never"}]
Schema
{ "oneOf": [ { "type": "string", "enum": [ "never" ] }, { "type": "object", "properties": { "property": { "type": "string", "enum": [ "never" ] }, "method": { "type": "string", "enum": [ "never" ] } }, "minProperties": 1, "maxProperties": 2 } ] }