unicorn/prefer-spread Style
What it does
Enforces the use of the spread operator (...) over outdated patterns.
Why is this bad?
Using the spread operator is more concise and readable.
Examples
Examples of incorrect code for this rule:
javascript
const foo = Array.from(set);
const foo = Array.from(new Set([1, 2]));Examples of correct code for this rule:
javascript
[...set].map(() => {});
Array.from(...argumentsArray);How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny unicorn/prefer-spreadjson
{
"rules": {
"unicorn/prefer-spread": "error"
}
}