Skip to content

nativeObjectExtensions

Reports extending the prototype of native JavaScript objects.

✅ This rule is included in the ts javascript presets.

Extending native JavaScript prototypes like Array.prototype or Object.prototype affects all instances of that type across the entire codebase. This can cause conflicts with other libraries that expect standard prototype behavior. Future ECMAScript versions may add methods with the same name, causing unexpected behavior when those methods are overwritten.

B0ArrA72prototyAB0cust5<3 sp ansty="le--0:#C792EA;--1:#8844">A5<3 sp ansty="le--0:#C792EA;--1:#8844">AEfuncti5<3 sp ansty="le--0:#D9F5DD;--1:#1111">11<()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">72th5<3;d ivclassNa="meec-li">53<};d ivclassNa="meco"><};d>B0ObjeA72prototyA72meth5<3 sp ansty="le--0:#C792EA;--1:#8844">A5<3 sp ansty="le--0:#F78C6C;--1:#AA09">821<23sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco"><3;d>B0StriA72prototyAB0toTitleCa5<3 sp ansty="le--0:#C792EA;--1:#8844">A5<3 sp ansty="le--0:#C792EA;--1:#8844">AEfuncti5<3 sp ansty="le--0:#D9F5DD;--1:#1111">11<()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">72thAB0char5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8<20sp ansty="le--0:#D6DEEB;--1:#403F">5<3)sp ansty="le--0:#C792EA;--1:#8844">AB0toUpperCa53(<) sp ansty="le--0:#C792EA;--1:#8844">A5<3 sp ansty="le--0:#7FDBCA;--1:#096E">72thAB0sli5<3(sp ansty="le--0:#F78C6C;--1:#AA09">8<21sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meec-li">53<};d ivclassNa="meco"><};d>53ObjeAB0defineProper5<3(sp ansty="le--0:#C5E478;--1:#3B61">B0ArrA72prototy53<, sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dcust1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53,< {d ivclassNa="meec-li">nt< sp ansty="le--0:#82AAFF;--1:#3B61">B0val53<: sp ansty="le--0:#C792EA;--1:#8844">AEfuncti5<3 sp ansty="le--0:#D9F5DD;--1:#1111">11<()sp ansty="le--0:#D6DEEB;--1:#403F">53 {<},d ivclassNa="meec-li">53}<);d ivclassNa="meco"><);d>53ObjeAB0defineProperti5<3(sp ansty="le--0:#C5E478;--1:#3B61">B0ObjeA72prototy53,< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53method: { value<: sp ansty="le--0:#F78C6C;--1:#AA09">821<23sp ansty="le--0:#D6DEEB;--1:#403F">53 <},d ivclassNa="meec-li">53}<);d ivclassNa="meco"><);d>
44AEfunc361B0customArrayMe31<111T spans="tyle--0:#D6DEEB;--1:#40">3 spans="tyle--0:#D9F5DD;--1:#11">1><111( spans="tyle--0:#D7DBE0;--1:#40">3F53a631<111T spans="tyle--0:#D6DEEB;--1:#40">3F<53[] spans="tyle--0:#D9F5DD;--1:#11">1<111) spans="tyle--0:#7FDBCA;--1:#09">631<111T spans="tyle--0:#D6DEEB;--1:#40">3F53<[] {divclass="Nameec-">de44AEre3F53 ar3<}di vdivclass="Nameexpressive-">44AEc31111ExtendedA31<111T spans="tyle--0:#D6DEEB;--1:#40">3F<53> spans="tyle--0:#C792EA;--1:#88">44AEext >361B0A31<111T spans="tyle--0:#D6DEEB;--1:#40">3F5<3> {divclass="Nameec-">de61B0cu11<11() spans="tyle--0:#D6DEEB;--1:#40">3F ><53 {divclass="Nameec-">dent< spans="tyle--0:#C792EA;--1:#88">44AEre36E7233F<53 spans="tyle--0:#D6DEEB;--1:#40">33< }><}di vdivclass="Nameexpressive-">44AEfunc361B0toTitle1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53v6361B0st1<111) spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">de44AEre3F53 v4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0ch30<9820 spans="tyle--0:#D6DEEB;--1:#40">34<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0toUpper3F5<3() spans="tyle--0:#C792EA;--1:#88">4<4AE+ spans="tyle--0:#D6DEEB;--1:#40">3F53 v4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0s30<9821 spans="tyle--0:#D6DEEB;--1:#40">3F<53) ;divclass="Nameec-">3<);><}di vdivclass="Nameexpressive-">44AEco61B0arrayU44AE< = {divclass="Nameec-">de61B0cu4<4AE< spans="tyle--0:#FFCB8B;--1:#11">1<111T spans="tyle--0:#C792EA;--1:#88">4<4AE> spans="tyle--0:#D9F5DD;--1:#11">1><111( spans="tyle--0:#D7DBE0;--1:#40">3F53a64<4AE spans="tyle--0:#FFCB8B;--1:#11">1<111T spans="tyle--0:#D6DEEB;--1:#40">3F<53[] spans="tyle--0:#D9F5DD;--1:#11">1<111) spans="tyle--0:#C792EA;--1:#88">4444AE< spans="tyle--0:#C792EA;--1:#88">44AEret3F53a4<4AE ;divclass="Nameec-">44444<4AE} spans="tyle--0:#D6DEEB;--1:#40">3<,}>

This rule is not configurable.

If you are developing a polyfill library that intentionally adds missing standard methods to native prototypes, you may need to disable this rule. Some frameworks also extend native prototypes as part of their core design, though this is increasingly rare in modern JavaScript development.