Skip to content

setterReturns

Reports return statements with values inside setters.

✅ This rule is included in the ts javascript presets.

The set syntax binds an object property to a function that will be called when there is an attempt to set that property. Setters are expected to have side effects only and not produce a return value. Any value returned from a setter is ignored by the JavaScript engine.

This rule reports when a setter contains a return statement with a value.

AEconsB0objeAE =< {d ivclassNa="meec-li">AE< sp ansty="le--0:#C792EA;--1:#8844">AEseB0val1<1(sp ansty="le--0:#D7DBE0;--1:#403F">53v1<1)sp ansty="le--0:#C792EA;--1:#8844">AE< {d ivclassNa="meec-li">AE < sp ansty="le--0:#C792EA;--1:#8844">AEretur53vAAE< sp ansty="le--0:#C792EA;--1:#8844">AE<},d ivclassNa="meec-li">A5<3;d ivclassNa="meco"><};d>AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Examp53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEs5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0na1<1(sp ansty="le--0:#D7DBE0;--1:#403F">53val1<1)sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt < sp ansty="le--0:#C792EA;--1:#8844">AEretu53 valu53< sp ansty="le--0:#D6DEEB;--1:#403F">5<3}d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Examp53< {d ivclassNa="meec-li">nt< 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">53v1<1)sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt < sp ansty="le--0:#C792EA;--1:#8844">AE53 (vaAsp ansty="le--0:#D6DEEB;--1:#403F">5sp><3 sp ansty="le--0:#F78C6C;--1:#AA09">8<20sp ansty="le--0:#D6DEEB;--1:#403F">53)< {d ivclassNa="meec-li">nt < sp ansty="le--0:#C792EA;--1:#8844">AEretu53 va53 < sp ansty="le--0:#D6DEEB;--1:#403F">5<3}d ivclassNa="meec-li">nt < sp ansty="le--0:#7FDBCA;--1:#096E">72thA72_val5<3 sp ansty="le--0:#C792EA;--1:#8844">A53 va53< sp ansty="le--0:#D6DEEB;--1:#403F">5<3}d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>
44AEco61B0ob44AE< = {divclass="Nameec-">4444AE61B0v1<111( spans="tyle--0:#D7DBE0;--1:#40">3F5<3val spans="tyle--0:#D9F5DD;--1:#11">1<111) spans="tyle--0:#C792EA;--1:#88">44dent< spans="tyle--0:#7FDBCA;--1:#09">6E724<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72_v44A3F5<3val spans="tyle--0:#C792EA;--1:#88">4<4AE ;divclass="Nameec-">44444<4AE} spans="tyle--0:#D6DEEB;--1:#40">3<,}><;di vdivclass="Nameexpressive-">44AEc31111Exa3F<53 {divclass="Nameec-">de44A361B01<111( spans="tyle--0:#D7DBE0;--1:#40">3F53v1<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_34<4AE= spans="tyle--0:#D6DEEB;--1:#40">3F53 va3F<53 spans="tyle--0:#D6DEEB;--1:#40">33< }><}di vdivclass="Nameexpressive-">44AEco61B0ob44AE< = {divclass="Nameec-">4444AE61B0v1<111( spans="tyle--0:#D7DBE0;--1:#40">3F5<3val spans="tyle--0:#D9F5DD;--1:#11">1<111) spans="tyle--0:#C792EA;--1:#88">4444AE< spans="tyle--0:#C792EA;--1:#88">44A34<4AE! spans="tyle--0:#D6DEEB;--1:#40">3F534444AE < spans="tyle--0:#C792EA;--1:#88">44AEret44AE< spans="tyle--0:#C792EA;--1:#88">4<4AE }divclass="Nameec-">dent< spans="tyle--0:#7FDBCA;--1:#09">6E724<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72_v44A3F5<3val spans="tyle--0:#C792EA;--1:#88">4<4AE ;divclass="Nameec-">44444<4AE} spans="tyle--0:#D6DEEB;--1:#40">3<,}>

This rule is not configurable.

If you are using an unusual non-standard tool that modifiers your setters at build time into standard functions, this rule may not be for you.