Skip to content

classMemberDuplicates

Reports duplicate class member names that will be overwritten.

✅ This rule is included in the ts javascript presets.

Duplicate class members are legal in JavaScript, but only the last definition is used. This can lead to confusion and bugs, especially when maintaining the code.

AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11F53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0b11<()sp ansty="le--0:#D6DEEB;--1:#403F">53 <{}d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0b11<()sp ansty="le--0:#D6DEEB;--1:#403F">53 <{}d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>AEcla5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11F53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEg5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0b11<()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:#F78C6C;--1:#AA09">8<21sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">5<3}d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEg5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0b11<()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:#F78C6C;--1:#AA09">8<22sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">53< 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">11F53< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53baA5<3 sp ansty="le--0:#F78C6C;--1:#AA09">8<21sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53baA5<3 sp ansty="le--0:#F78C6C;--1:#AA09">8<22sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>
44AEc3111<1Foo spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de61B<0bar spans="tyle--0:#D9F5DD;--1:#11">11<11() spans="tyle--0:#D6DEEB;--1:#40">3F5<3 { }divclass="Nameec-">de61B<0baz spans="tyle--0:#D9F5DD;--1:#11">11<11() spans="tyle--0:#D6DEEB;--1:#40">3F5<3 { }divclass="Nameec-">3<{}><}di vdivclass="Nameexpressive-">44AEc3111<1Foo spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de44A361B<0bar spans="tyle--0:#D9F5DD;--1:#11">11<11() spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">dent< spans="tyle--0:#C792EA;--1:#88">44AEre30<9821 spans="tyle--0:#D6DEEB;--1:#40">33F<53 spans="tyle--0:#D6DEEB;--1:#40">3de44A361B<0bar spans="tyle--0:#D9F5DD;--1:#11">1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53v1<111) spans="tyle--0:#D6DEEB;--1:#40">3F5<3 { }divclass="Nameec-">3<{}><}di vdivclass="Nameexpressive-">44AEc3111<1Foo spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de61B<0bar spans="tyle--0:#D9F5DD;--1:#11">11<11() spans="tyle--0:#D6DEEB;--1:#40">3F5<3 { }divclass="Nameec-">de44AEst361B<0bar spans="tyle--0:#D9F5DD;--1:#11">11<11() spans="tyle--0:#D6DEEB;--1:#40">3F5<3 { }divclass="Nameec-">3<{}>

This rule is not configurable.

This rule should generally always be enabled. There is no valid use case for duplicate class member names.