Skip to content

arrayFlatUnnecessaryDepths

Reports using 1 as the depth argument of .flat() since it is the default.

✅ This rule is included in the ts stylistic and stylisticStrict presets.

The default depth for Array.prototype.flat() is 1, so passing it explicitly is redundant. This rule reports when 1 is passed as the depth argument to .flat().

AEdeclare consB0arr7<2:sp ansty="le--0:#C792EA;--1:#8844">AB0numb53[][<];d ivclassNa="meec-li">53arrAB0fl5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8<21sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meco"><);d>AEdeclare consB0arr7<2:sp ansty="le--0:#C792EA;--1:#8844">AB0numb53[]<[]sp ansty="le--0:#C792EA;--1:#8844">A7<2|sp ansty="le--0:#C792EA;--1:#8844">AB0undefin5<3;d ivclassNa="meec-li">53arrAEB0fl5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8<21sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meco"><);d>
44AEdeclare co61B0a64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0nu3F53[<][] ;divclass="Nameec-">3F53a4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B03F5<3() ;divclass="Name"><;di vdivclass="Nameexpressive-">44AEdeclare co61B0a64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0nu3F53[][<][] ;divclass="Nameec-">3F53a4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B030<9822 spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Name"><(2)><;di vdivclass="Nameexpressive-">44AEdeclare co61B0a64<4AE spans="tyle--0:#C5E478;--1:#3B">61B0nu3F5<3[] ;divclass="Nameec-">3F53a4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0361B0Infi3F<53) ;divclass="Name">

This rule is not configurable.

If you prefer to be explicit about the depth argument for readability or consistency, you may disable this rule.