Pattern: Inconsistent empty array spread in ternary
Issue: -
When spreading a ternary expression in an array, use consistent types (either arrays or strings) in both branches for better code clarity.
Example of incorrect code:
const array = [a, ...(foo ? [b, c] : "")];
const array = [a, ...(foo ? "bc" : [])];
Example of correct code:
const array = [a, ...(foo ? [b, c] : [])];
const array = [a, ...(foo ? "bc" : "")];