Reports parseInt calls that are missing or have an invalid radix parameter.
✅ This rule is included in the ts logical and logicalStrict presets.
When using the parseInt() function it is common to omit the second argument, the radix, and let the function try to determine from the first argument what type of number it is.
By default, parseInt() will autodetect decimal and hexadecimal (via 0x prefix).
Prior to ECMAScript 5, parseInt() also autodetected octal literals, which caused problems because many developers assumed a leading 0 would be ignored.
This confusion led to the suggestion that you always use the radix parameter to parseInt() to eliminate unintended consequences.
B0parseI5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D01"sp><71sp ansty="le--0:#D9F5DD;--1:#1111">171sp><1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><);d ivclassNa="meco"><);d>);d>);d>B0parseI53(someValue<);d ivclassNa="meco"><);d>);d>);d>53NumbAB0parseI5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D01"sp><71sp ansty="le--0:#D9F5DD;--1:#1111">171sp><1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><);d ivclassNa="meco"><);d>);d>);d>B0parseI5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D1"sp><10sp ansty="le--0:#D9F5DD;--1:#1111">110sp><1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><, sp ansty="le--0:#F78C6C;--1:#AA09">8, sp><21sp ansty="le--0:#D6DEEB;--1:#403F">5321sp><);d ivclassNa="meco"><);d>);d>);d>B0parseI5<3(sp ansty="le--0:#D9F5DD;--1:#1111">13(sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D1"sp><10sp ansty="le--0:#D9F5DD;--1:#1111">110sp><1"sp ansty="le--0:#D6DEEB;--1:#403F">531"sp><, sp ansty="le--0:#F78C6C;--1:#AA09">82, sp><37sp ansty="le--0:#D6DEEB;--1:#403F">5337sp><);d ivclassNa="meco"><);d>);d>);d> 61B0pars31<111" spans="tyle--0:#ECC48D;--1:#98">4E4111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53, spans="tyle--0:#F78C6C;--1:#AA">0953, ><8210 spans="tyle--0:#D6DEEB;--1:#40">3F8210><53) ;divclass="Name"><10)>10)>53)><;di vdivclass="Nameexpressive-">61B0pars31<111" spans="tyle--0:#ECC48D;--1:#98">4E4111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53, spans="tyle--0:#F78C6C;--1:#AA">053, ><9828 spans="tyle--0:#D6DEEB;--1:#40">3F9828><53) ;divclass="Name">< 8)> 8)>53)>;di><;di vdivclass="Nameexpressive-">3F53Nu4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0pars4AE.>3F53(someVal09<8210 spans="tyle--0:#D6DEEB;--1:#40">3F8210><53) ;divclass="Name"><10)>10)>53)>;di><;di vdivclass="Nameexpressive-">61B0pars31<111" spans="tyle--0:#ECC48D;--1:#98">4E111"><4D10 spans="tyle--0:#D9F5DD;--1:#11">14D10><111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53, spans="tyle--0:#F78C6C;--1:#AA">0953, ><8216 spans="tyle--0:#D6DEEB;--1:#40">3F8216><53) ;divclass="Name"><16)>16)>53)>;di><;di vdivclass="Nameexpressive-">61B0pars31<111" spans="tyle--0:#ECC48D;--1:#98">4E111"><4D10 spans="tyle--0:#D9F5DD;--1:#11">14D10><111" spans="tyle--0:#D6DEEB;--1:#40">3F53, rad111">;di>
This rule is not configurable.
If you are confident that your codebase always uses decimal strings without leading zeros, it may be preferable to disable this rule.