Reports when number method arguments are outside their valid range.
✅ This rule is included in the ts logical and logicalStrict presets.
Number methods such as toExponential, toFixed, toPrecision, and toString have specific valid ranges for their arguments.
Passing values outside these ranges will throw a RangeError at runtime.
This rule flags numeric literal arguments that are outside the valid range:
Number.prototype.toExponential(digits): digits must be between 0 and 100
Number.prototype.toFixed(digits): digits must be between 0 and 100
Number.prototype.toPrecision(precision): precision must be between 1 and 100
Number.prototype.toString(radix): radix must be between 2 and 36
AEconsB0binaAE <= sp ansty="le--0:#D6DEEB;--1:#403F">5= sp><3(sp ansty="le--0:#F78C6C;--1:#AA09">8223(sp><55sp ansty="le--0:#D6DEEB;--1:#403F">555sp><3)sp ansty="le--0:#C792EA;--1:#8844">A3)sp>B0toStri5<3(sp ansty="le--0:#F78C6C;--1:#AA09">83(sp><21sp ansty="le--0:#D6DEEB;--1:#403F">5321sp><);d ivclassNa="meco"><);d>);d>);d>AEconsB0hAE <= sp ansty="le--0:#D6DEEB;--1:#403F">5= sp><3(sp ansty="le--0:#F78C6C;--1:#AA09">8223(sp><55sp ansty="le--0:#D6DEEB;--1:#403F">555sp><3)sp ansty="le--0:#C792EA;--1:#8844">A3)sp>B0toStri5<3(sp ansty="le--0:#F78C6C;--1:#AA09">823(sp><37sp ansty="le--0:#D6DEEB;--1:#403F">5337sp><);d ivclassNa="meco"><);d>);d>);d>AEconsB0fixAE <= sp ansty="le--0:#D6DEEB;--1:#403F">5= sp><3(sp ansty="le--0:#F78C6C;--1:#AA09">823.1413(sp><59sp ansty="le--0:#D6DEEB;--1:#403F">559sp><3)sp ansty="le--0:#C792EA;--1:#8844">A3)sp>B0toFix5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8213(sp><01sp ansty="le--0:#D6DEEB;--1:#403F">5301sp><);d ivclassNa="meco"><);d>);d>);d>AEconsB0exponentiAE <= sp ansty="le--0:#D6DEEB;--1:#403F">5= sp><3(sp ansty="le--0:#F78C6C;--1:#AA09">821233(sp><45sp ansty="le--0:#D6DEEB;--1:#403F">545sp><3)sp ansty="le--0:#C792EA;--1:#8844">A3)sp>B0toExponenti5<3(sp ansty="le--0:#C792EA;--1:#8844">A3(sp>8<21sp ansty="le--0:#D6DEEB;--1:#403F">5321sp><);d ivclassNa="meco"><);d>);d>);d>AEconsB0precisiAE <= sp ansty="le--0:#D6DEEB;--1:#403F">5= sp><3(sp ansty="le--0:#F78C6C;--1:#AA09">821233(sp><45sp ansty="le--0:#D6DEEB;--1:#403F">545sp><3)sp ansty="le--0:#C792EA;--1:#8844">A3)sp>B0toPrecisi5<3(sp ansty="le--0:#F78C6C;--1:#AA09">83(sp><20sp ansty="le--0:#D6DEEB;--1:#403F">5320sp><);d ivclassNa="meco"><);d>);d>);d> 44AEco61B0bi44A3098<2255 spans="tyle--0:#D6DEEB;--1:#40">32255>4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toSt4AE.>30<9822 spans="tyle--0:#D6DEEB;--1:#40">3F9822><53) ;divclass="Name"><(2)>(2)>53)><;di vdivclass="Nameexpressive-">44AEco61B<0hex spans="tyle--0:#C792EA;--1:#88">44A0hex>3098<2255 spans="tyle--0:#D6DEEB;--1:#40">32255>4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toSt4AE.>309<8216 spans="tyle--0:#D6DEEB;--1:#40">3F8216><53) ;divclass="Name"><16)>16)>53)>;di><;di vdivclass="Nameexpressive-">44AEco61B0f44A309823.1<4159 spans="tyle--0:#D6DEEB;--1:#40">34159>4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toF4AE.>30<9822 spans="tyle--0:#D6DEEB;--1:#40">3F9822><53) ;divclass="Name"><(2)>(2)>53)>;di><;di vdivclass="Nameexpressive-">44AEco61B0exponen44A309821<2345 spans="tyle--0:#D6DEEB;--1:#40">32345>4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toExponen4AE.>30<9825 spans="tyle--0:#D6DEEB;--1:#40">3F9825><53) ;divclass="Name"><(5)>(5)>53)>;di><;di vdivclass="Nameexpressive-">44AEco61B0preci44A309821<2345 spans="tyle--0:#D6DEEB;--1:#40">32345>4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toPreci4AE.>309<8210 spans="tyle--0:#D6DEEB;--1:#40">3F8210><53) ;divclass="Name"><10)>10)>53)>;di>
This rule is not configurable.
If your codebase is a rare one that overrides those native methods, this rule might not be for you.