πΌ This rule is enabled in the following configs: β
recommended, βοΈ unopinionated.
π§ This rule is automatically fixable by the --fix CLI option.
Spreading falsy values in object literals won't add any unexpected properties, so it's unnecessary to add an empty object as fallback.
// β
const object = {...(foo || {})};
// β
const object = {...(foo ?? {})};
// β
const object = {...foo};// β
const object = {...(foo && {})};// β
const array = [...(foo || [])];