Reputation: 3975
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!
Upvotes: 2
Views: 1042
Reputation: 47961
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.
Upvotes: 2