-
-
Notifications
You must be signed in to change notification settings - Fork 439
Closed
Labels
Description
Fail
const set = new Set([1, 2]);
Array.from(set).map(() => {});Pass
const set = new Set([1, 2]);
[...set].map(() => {});The only difference between them is that Array.from() also works on array-like objects, while spread requires something to implement the iterator protocol, but we don't care about that, as it's what you should do anyway.
Should be easy to make this auto-fixable.
There's already a built-in ESLint rule called prefer-spread, but it's only concerned about .apply().
Reactions are currently unavailable