sindresorhus/eslint-plugin-unicorn

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

Closed

#1,788 opened on Apr 2, 2022

 (4 comments) (1 reaction) (0 assignees)JavaScript (468 forks)user submission
bughelp wantedtypes

Repository metrics

Stars
 (5,022 stars)
PR merge metrics
 (Avg merge 1d 16h) (399 merged PRs in 30d)

Description

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))
);

Contributor guide