HubSpot/javascript

[Object] No parentheses around object literals

geekjuice opened this issue · 0 comments

Add note about defining object literals without the extra parentheses around them. For example:

// bad
const obj = ({
  hello: 'world',
  foo: 'bar'
});

// good
const obj = {
  hello: 'world',
  foo: 'bar'
};

While I've never seen this in practice, this rule is to prevent a situation like:

const obj = ({hello: 'world'}, {foo: 'bar'})
// returns {foo: 'bar'}

\cc @gusvargas