Skip to content

emptyDestructures

Reports using empty destructuring patterns that destructure no values.

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

Empty destructuring patterns like {} or [] don’t extract any values from the source object or array and serve no practical purpose. These patterns are typically mistakes or leftover code from refactoring where variables were removed but the destructuring syntax remained.

AEconst {} <= sp ansty="le--0:#D6DEEB;--1:#403F">53objecAEconst [] <= sp ansty="le--0:#D6DEEB;--1:#403F">53arradAEfuncti5<3 sp ansty="le--0:#82AAFF;--1:#3B61">B0proce1<1(sp ansty="le--0:#D6DEEB;--1:#403F">53<{}sp ansty="le--0:#D9F5DD;--1:#1111">1<1)sp ansty="le--0:#D6DEEB;--1:#403F">53< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53consoAB0l5<3(sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4DNo values extract1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meec-li">5<3}d ivclassNa="meec-li">dAEf53< (sp ansty="le--0:#C792EA;--1:#8844">AEconst {<} sp ansty="le--0:#7FDBCA;--1:#096E">7253 items)< {d ivclassNa="meec-li">53< sp ansty="le--0:#D6DEEB;--1:#403F">53consoAB0l5<3(sp ansty="le--0:#D9F5DD;--1:#1111">1<1"sp ansty="le--0:#ECC48D;--1:#984E">4DNo values extracted in lo1<1"sp ansty="le--0:#D6DEEB;--1:#403F">53<);d ivclassNa="meec-li">5<3}d ivclassNa="meco"><}d>
44AEcons61B04461B<0age spans="tyle--0:#C792EA;--1:#88">44AE <} = spans="tyle--0:#D6DEEB;--1:#40">3F53per44AEcon61B0f4461B0se44AE<] = spans="tyle--0:#D6DEEB;--1:#40">3F53arc44AEfunc361B0pro1<111( spans="tyle--1:#40"><3F53 spans="tyle--0:#D6">DEDB6<67B, spans="tyle--1:#40"><3F53 spans="tyle--0:#D6">DDBE0vDE1<111) spans="tyle--0:#D6DEEB;--1:#40">3F<53 {divclass="Nameec-">3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53con4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B<0log spans="tyle--0:#D6DEEB;--1:#40">3F5<3(id spans="tyle--0:#889FB2;--1:#4D">6<67B, spans="tyle--0:#D6DEEB;--1:#40">3F53 val3c44A3F<53 ( spans="tyle--0:#C792EA;--1:#88">44AEcons61B044A6E<72of spans="tyle--0:#D6DEEB;--1:#40">3F53 item3F<53 spans="tyle--0:#D6DEEB;--1:#40">3F53con4<4AE. spans="tyle--0:#82AAFF;--1:#3B">61B<0log spans="tyle--0:#D6DEEB;--1:#40">3F53(it3c6376// Empty object/array literals are fine (not destructur44AEco61B0e44AE <= {} spans="tyle--0:#D6DEEB;--1:#40">344AEco61B0emptyA443F53< [] ;divclass="Name">< []>

This rule is not configurable.

If you have code that intentionally uses empty destructuring patterns for some reason (though this is rare), you might choose to disable this rule. However, in most cases, empty destructuring patterns indicate an error or code that should be cleaned up.