Enforces the use of the spread operator (...
) over
-
Array.from(…)
Convert
Iterable
toArray
.This rule adds on to the built-in prefer-spread rule, which only flags uses of
.apply()
. Does not enforce forTypedArray.from()
. -
Array#concat(…)
Concat an
Array
with one or moreArray
's orArray
elements. -
Array#slice()
Shallow copy an
Array
.Variables named
arrayBuffer
,blob
,buffer
,file
, andthis
are ignored.
This rule is partly fixable.
Array.from(set).map(element => foo(element));
const array = array1.concat(array2);
const copy = array.slice();
[...set].map(element => foo(element));
const array = [...array1, ...array2];
const tail = array.slice(1);
const copy = [...array];