emptyDestructures
Reports using empty destructuring patterns that destructure no values.
✅ This rule is included in the ts logical
preset.
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.
Examples
Section titled “Examples”const {} = object;const [] = array;
function process({}) { console.log("No values extracted");}
for (const {} of items) { console.log("No values extracted in loop");}
const { name, age } = person;const [first, second] = array;
function process({ id, value }) { console.log(id, value);}
for (const { item } of items) { console.log(item);}
// Empty object/array literals are fine (not destructuring)const empty = {};const emptyArray = [];
Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”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.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noEmptyPattern
- Deno:
no-empty-pattern
- ESLint:
no-empty-pattern
- Oxlint:
eslint/no-empty-pattern
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.