sindresorhus/eslint-plugin-unicorn
`no-useless-spread` False positive with iterator helpers
Fechada
#2.018 aberto em 19 de dez. de 2022
bughelp wanted
Métricas do repositório
- Stars
- (5.022 estrelas)
- Métricas de merge de PR
- (Mesclagem média 4h 30m) (26 fundiu PRs em 30d)
Description
When using a polyfill for TC39 Iterator Helpers, trying to convert a generator produced by one of the helpers to an array via the spread operator, results in said spread operator being marked as useless.
Rule effected: unicorn/no-useless-spread
Example:
const data = new Map([["a", 1], ["b", 2], ["c", 3]]);
const foo = [...data.values().map((d) => d * 2)]; // [2, 4, 6]
is incorrectly flagged and fixed to:
const data = new Map([["a", 1], ["b", 2], ["c", 3]]);
const foo = data.values().map((d) => d * 2); // Generator<number, void, undefined>