sindresorhus/eslint-plugin-unicorn

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

已关闭

#2,007 创建于 2022年12月6日

 (2 条评论) (0 个反应) (0 位负责人)JavaScript (468 个派生)user submission
bughelp wanted

仓库指标

星标
 (5,022 个星标)
PR 合并指标
 (平均合并 4小时 30分钟) (30 天内合并 26 个 PR)

描述

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

贡献者指南