'Does EsLint have a rule to prefer Object values as key and value?
Looking for a rule(can't seem to find anything, might've just missed it) in EsLint to basically prefer something like this:
const example = {
foo,
bar
};
vs something like this:
const example = {
foo: foo,
bar: bar
};
Thanks in advance!
Solution 1:[1]
You are looking for the rule object-shorthand:
Requires or disallows method and property shorthand syntax for object literals.
It will work fine with the default settings. You can test it in this demo.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | GOTO 0 |
