Reports comparing charAt() results with strings longer than one character.
✅ This rule is included in the ts logical and logicalStrict presets.
The charAt method returns a string of exactly one character.
If the return value is compared with a string of length greater than one, the comparison will always evaluate to the same result.
Equality comparisons (===, ==) will always be false, and inequality comparisons (!==, !=) will always be true.
53teAB0char5<3(sp ansty="le--0:#F78C6C;--1:#AA09">83(sp><20sp ansty="le--0:#D6DEEB;--1:#403F">5320sp><) sp ansty="le--0:#C792EA;--1:#8844">AE=) sp><==sp ansty="le--0:#D6DEEB;--1:#403F">5==sp><3 sp ansty="le--0:#D9F5DD;--1:#1111">13 sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4D1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">51"sp><3;d ivclassNa="meco"><";d>";d>3;d>1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Da1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">51"sp><3 sp ansty="le--0:#C792EA;--1:#8844">AE=3 sp><==sp ansty="le--0:#D6DEEB;--1:#403F">53 te==sp>AB0char5<3(sp ansty="le--0:#F78C6C;--1:#AA09">83(sp><20sp ansty="le--0:#D6DEEB;--1:#403F">5320sp><);d ivclassNa="meco"><);d>);d>);d>53teAB0char5<3(sp ansty="le--0:#F78C6C;--1:#AA09">83(sp><20sp ansty="le--0:#D6DEEB;--1:#403F">5320sp><) sp ansty="le--0:#C792EA;--1:#8844">AE!) sp><==sp ansty="le--0:#D6DEEB;--1:#403F">5==sp><3 sp ansty="le--0:#D9F5DD;--1:#1111">13 sp><1"sp ansty="le--0:#ECC48D;--1:#984E">4Dhel1"sp>1<1"sp ansty="le--0:#D6DEEB;--1:#403F">51"sp><3;d ivclassNa="meco"><";d>";d>3;d> 3F534<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0ch4AE.>30<9820 spans="tyle--0:#D6DEEB;--1:#40">3F9820><53) spans="tyle--0:#C792EA;--1:#88">44A53) >31<111" spans="tyle--0:#ECC48D;--1:#98">4111">1<111" spans="tyle--0:#D6DEEB;--1:#40">3111"><"a">"a"><;di vdivclass="Nameexpressive-">3F534<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0s4AE.>30<9820 spans="tyle--0:#D6DEEB;--1:#40">3F9820><53, spans="tyle--0:#F78C6C;--1:#AA">053, ><9822 spans="tyle--0:#D6DEEB;--1:#40">3F9822><53) spans="tyle--0:#C792EA;--1:#88">44A53) >31<111" spans="tyle--0:#ECC48D;--1:#98">4E111"><4Dab spans="tyle--0:#D9F5DD;--1:#11">14Dab><111" spans="tyle--0:#D6DEEB;--1:#40">3111"> ;di><;di vdivclass="Nameexpressive-">3F534<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0starts4AE.>31<111" spans="tyle--0:#ECC48D;--1:#98">4E111"><4Dab spans="tyle--0:#D9F5DD;--1:#11">14Dab><111" spans="tyle--0:#D6DEEB;--1:#40">3F111"><53) ;divclass="Name">53)>;di>
This rule is not configurable.
This rule catches a specific programming error with no legitimate use cases.
There is no reason to disable this rule.