sindresorhus/eslint-plugin-unicorn

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

Chiusa

#2007 aperta il 6 dic 2022

 (2 commenti) (0 reazioni) (0 assegnatari)JavaScript (468 fork)user submission
bughelp wanted

Metriche repository

Star
 (5022 stelle)
Metriche merge PR
 (Merge medio 1g 16h) (399 PR mergiate in 30 g)

Descrizione

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

Guida contributor