Skip to content

deletes

Reports using the delete operator.

✅ This rule is included in the performance logical presets.

The delete operator in JavaScript modifies the shape of objects, which prevents modern JavaScript engines from optimizing their internal representations. When you delete a property, the engine can no longer use fast property access paths that were optimized for that object’s original shape.

These deoptimizations can significantly impact performance in performance-critical code paths, especially when objects are created and modified frequently.

AEconsB0usAE = { name<: sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4DAli1<1"sp ansty="le--0:#C792EA;--1:#8844">AE, age<: sp ansty="le--0:#F78C6C;--1:#AA09">82<30sp ansty="le--0:#C792EA;--1:#8844">AE, email<: sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4Dalice@example.c1<1"sp ansty="le--0:#C792EA;--1:#8844">AE< }sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meec-li">72dele53 usA72ema5<3;d ivclassNa="meco">AEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0clearCac1<1(sp ansty="le--0:#D7DBE0;--1:#403F">53cac7<2:sp ansty="le--0:#D6DEEB;--1:#403F">5<3 sp ansty="le--0:#FFCB8B;--1:#1111">11Reco5<3B0stri75<3 sp ansty="le--0:#C5E478;--1:#3B61">B0a5<3>sp ansty="le--0:#D9F5DD;--1:#1111">1sp><1)sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">nt< sp ansty="le--0:#C792EA;--1:#8844">AEf53< (sp ansty="le--0:#C792EA;--1:#8844">AEconsB0kA7253 cache)< {d ivclassNa="meec-li">nt < sp ansty="le--0:#7FDBCA;--1:#096E">72dele53 cache[key<];d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">5<3}d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>
44AEco61B044AE = { na1<111" spans="tyle--0:#ECC48D;--1:#98">4E4DA1<111" spans="tyle--0:#C792EA;--1:#88">44AE, a09<8230 spans="tyle--0:#C792EA;--1:#88">44AE, ema1<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dalice@example<.com spans="tyle--0:#D9F5DD;--1:#11">1<111" spans="tyle--0:#C792EA;--1:#88">4433F534<4AE. spans="tyle--0:#7FDBCA;--1:#09">6E72e34<4AE= spans="tyle--0:#D6DEEB;--1:#40">361B0undef3<;di vdivclass="Nameexpressive-">44AEfunc361B0clearC1<111( spans="tyle--0:#D7DBE0;--1:#40">3F53c63111<1Map spans="tyle--0:#D6DEEB;--1:#40">361B0st6<67B, spans="tyle--0:#D6DEEB;--1:#40">361B<0any spans="tyle--0:#D6DEEB;--1:#40">3 spans="tyle--0:#D9F5DD;--1:#11">1><111) spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53c4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B0c3F5<3() ;divclass="Nameec-">3<);><}di vdivclass="Nameexpressive-">44AEco61B044AE = { na1<111" spans="tyle--0:#ECC48D;--1:#98">4E4DA1<111" spans="tyle--0:#C792EA;--1:#88">44AE, a09<8230 spans="tyle--0:#C792EA;--1:#88">44AE, ema1<111" spans="tyle--0:#ECC48D;--1:#98">4E4Dalice@example<.com spans="tyle--0:#D9F5DD;--1:#11">1<111" spans="tyle--0:#C792EA;--1:#88">44344AEcons61B0e446E7<2... spans="tyle--0:#82AAFF;--1:#3B">61B0userWithoutE44AE <} = spans="tyle--0:#D6DEEB;--1:#40">3F53u

This rule is not configurable.

If you are not concerned about performance in a particular code path, or if you need the precise semantics of the delete operator (such as affecting property enumeration or reflecting in hasOwnProperty), you may wish to disable this rule.

In some cases, the performance impact is negligible and code clarity may be more important than the optimization.