sindresorhus/eslint-plugin-unicorn

autofix `unicorn/prefer-array-some` can corrupt code easily

クローズ

#2,007 opened on 2022/12/06

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

Repository metrics

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

説明

code like

var res = $module.filter(selector.disabled).length > 0;

is currently autofixed to

var res = $module.some(selector.disabled);

but there is no $().some jQuery function, so the code is broken after autofix

IMHO the rule is legit, but there should be no autofix if the source cannot be 100% reasoned as an array

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