sindresorhus/eslint-plugin-unicorn

`no-array-for-each`: False positive with non-arrays

Chiusa

#1788 aperta il 2 apr 2022

 (4 commenti) (1 reazione) (0 assegnatari)JavaScript (468 fork)user submission
bughelp wantedtypes

Metriche repository

Star
 (5022 stelle)
Metriche merge PR
 (Merge medio 4h 30m) (26 PR mergiate in 30 g)

Descrizione

Here CB is an object with a bunch of functions on it. The forEach function has nothing to do arrays but gets flagged.

import * as CB from "strict-callbag-basics";

CB.pipe(
  CB.interval(1000),
  CB.map(x => x + 1),
  CB.filter(x => x % 2),
  CB.take(5),
  CB.forEach(x => console.log(x))
);

Guida contributor