Reports unnecessary array length checks before .some() or .every() calls.
✅ This rule is included in the ts logical presets.
Array#some() returns false for an empty array, so checking array.length !== 0 or array.length > 0 before calling .some() is redundant.
Array#every() returns true for an empty array, so checking array.length === 0 before calling .every() is redundant.
This rule reports these unnecessary length checks.
AEdeclare consB0arr7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0boole53[<];d ivclassNa="meec-li">53arrA72leng5<3 sp ansty="le--0:#C792EA;--1:#8844">AE!3 sp><==sp ansty="le--0:#D6DEEB;--1:#403F">5==sp><3 sp ansty="le--0:#F78C6C;--1:#AA09">83 sp><20sp ansty="le--0:#D6DEEB;--1:#403F">520sp><3 sp ansty="le--0:#C792EA;--1:#8844">AE3 sp><&&sp ansty="le--0:#D6DEEB;--1:#403F">53 arr&&sp>AB0so53(Boolean];d><);d ivclassNa="meco"><);d>);d>);d>AEdeclare consB0arr7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0boole53[<];d ivclassNa="meec-li">53arrA72leng5<3 sp ansty="le--0:#C792EA;--1:#8844">A3 sp>sp ansty="le--0:#D6DEEB;--1:#403F">5sp><3 sp ansty="le--0:#F78C6C;--1:#AA09">83 sp><20sp ansty="le--0:#D6DEEB;--1:#403F">520sp><3 sp ansty="le--0:#C792EA;--1:#8844">AE3 sp><&&sp ansty="le--0:#D6DEEB;--1:#403F">53 arr&&sp>AB0so53(Boolean];d><);d ivclassNa="meco"> 0 && array.some(Boolean"><);d>);d>);d>AEdeclare consB0arr7<2:sp ansty="le--0:#C792EA;--1:#8844">A2:sp>B0boole53[<];d ivclassNa="meec-li">53arrA72leng5<3 sp ansty="le--0:#C792EA;--1:#8844">AE=3 sp><==sp ansty="le--0:#D6DEEB;--1:#403F">5==sp><3 sp ansty="le--0:#F78C6C;--1:#AA09">83 sp><20sp ansty="le--0:#D6DEEB;--1:#403F">520sp><3 sp ansty="le--0:#C792EA;--1:#8844">AE3 sp><||sp ansty="le--0:#D6DEEB;--1:#403F">53 arr||sp>AB0eve53(Boolean];d><);d ivclassNa="meco"><);d>);d>);d> 44AEdeclare co61B0a64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0boo4AE >3F5<3[] ;divclass="Nameec-">3F53a4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B04AE.>3F53(Boole3[]><;di vdivclass="Nameexpressive-">44AEdeclare co61B0a64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0boo4AE >3F5<3[] ;divclass="Nameec-">3F53a4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0e4AE.>3F53(Boole3[]>;di><;di vdivclass="Nameexpressive-">44AEdeclare co61B0a64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0boo4AE >3F5<3[] ;divclass="Nameec-">3F53a4<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72le4AE.>344A30<9820 spans="tyle--0:#D6DEEB;--1:#40">39820>443F53 a4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0e4AE.>3F53(Boole3[]>;di><;di vdivclass="Nameexpressive-">44AEdeclare co61B0a64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0boo4AE >3F5<3[] ;divclass="Nameec-">3F53a4<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72le4AE.>344A30<9820 spans="tyle--0:#D6DEEB;--1:#40">39820>443F53 a4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B04AE.>3F53(Boole3[]>;di>
This rule is not configurable.
If you prefer explicit length checks for documentation purposes, or if your team’s coding standards require them, you may disable this rule.