sindresorhus/eslint-plugin-unicorn

`no-fn-reference-in-iterator` false positives on non-array methods

クローズ

#568 opened on 2020/02/27

 (24 件のコメント) (1 件のリアクション) (0 人の担当者)JavaScript (468 件のフォーク)user submission
bughelp wantedtypes

Repository metrics

Stars
 (5,022 個のスター)
PR merge metrics
 (平均マージ 4h 30m) (30d で 26 merged PRs)

説明

const obj = {filter: () => {}};
obj.filter([].join()); // error: Do not pass a function reference directly to an iterator method

.filter is not an iterator here. I think the rule confuses it with Array.prototype.filter and the false-positive seems specifically triggered by a CallExpression argument.

The autofix produces broken code for this case.

コントリビューターガイド