Skip to content

accessorThisRecursion

Reports recursive access to this within getters and setters.

✅ This rule is included in the ts logical and logicalStrict presets.

Accessing this.propertyName inside a getter or setter for propertyName triggers that same accessor again, causing infinite recursion and a stack overflow error at runtime.

AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Examp53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEg5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0na11<()sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt < sp ansty="le--0:#C792EA;--1:#8844">AEretu5<3 sp ansty="le--0:#7FDBCA;--1:#096E">72thA72na5<3;d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">5<3}d ivclassNa="meec-li">dnt< sp ansty="le--0:#C792EA;--1:#8844">AEs5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0val1<1(sp ansty="le--0:#D7DBE0;--1:#403F">53newVal7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#C5E478;--1:#3B61">B0numb1<1)sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt < sp ansty="le--0:#7FDBCA;--1:#096E">72thA72val5<3 sp ansty="le--0:#C792EA;--1:#8844">A53 newValu53< sp ansty="le--0:#D6DEEB;--1:#403F">5<3}d ivclassNa="meec-li">5<3}d ivclassNa="meec-li">dAEconsB0oAE =< {d ivclassNa="meec-li">AE< sp ansty="le--0:#C792EA;--1:#8844">AEgeB0cou11<()sp ansty="le--0:#C792EA;--1:#8844">AE< {d ivclassNa="meec-li">AE < sp ansty="le--0:#C792EA;--1:#8844">AEretur72thA72couAAE< sp ansty="le--0:#C792EA;--1:#8844">AE<},d ivclassNa="meec-li">A5<3;d ivclassNa="meco"><};d>
44AEc31111Exa3F<53 {divclass="Nameec-">de44AEpri3F53 _6361B0st34<4AE= spans="tyle--0:#D6DEEB;--1:#40">311<11"" spans="tyle--0:#D6DEEB;--1:#40">3de44AEpri3F53 _v6361B0nu34<4AE= spans="tyle--0:#D6DEEB;--1:#40">30<9820 spans="tyle--0:#D6DEEB;--1:#40">3cde44A361B011<11() spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">dent< spans="tyle--0:#C792EA;--1:#88">44AEre36E724<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72_33F<53 spans="tyle--0:#D6DEEB;--1:#40">3cde44A361B0v1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53newV6361B0nu1<111) spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">dent< spans="tyle--0:#7FDBCA;--1:#09">6E724<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72_v34<4AE= spans="tyle--0:#D6DEEB;--1:#40">3F53 newVa3F<53 spans="tyle--0:#D6DEEB;--1:#40">33c44AEco61B<0obj spans="tyle--0:#C792EA;--1:#88">44AE< = {divclass="Nameec-">4444AE_cou0<9820 spans="tyle--0:#C792EA;--1:#88">4<4AE ,divclass="Nameec-">4444AE61B0c11<11() spans="tyle--0:#C792EA;--1:#88">4444AE< spans="tyle--0:#C792EA;--1:#88">44AEret6E724<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72_c4<4AE ;divclass="Nameec-">44444<4AE} spans="tyle--0:#D6DEEB;--1:#40">3<,}>

This rule is not configurable.

There’s no reason to disable this rule, as recursive accessor access always causes a runtime error.