Skip to content

no-empty-pattern

Reports a destructuring pattern with nothing in it: {} or [] in a declaration, a parameter, an assignment target or nested in another pattern (var {a: {}} = x). A default value in a pattern ({a = {}}) is not an empty pattern.

An empty pattern binds no name, so the statement does nothing but check that the value is not null or undefined. It is usually a mistake for a default value: function f({a: {}}) {} was meant to be function f({a = {}}) {}, and the parameter stays without a default.

To fix, write the names to bind, or the default with =.

Reported
...
var g = () => {};
...
class K { static {} }
var {} = o, [] = p, [,] = q, { a: {} } = r;
({} = o);
...
js:
lint:
rules:
no-empty-pattern: warn # off, warn (default), error

Enabled by the presets: js/eslint-recommended, js/biome-recommended, js/oxlint.

Suppress one line with sudsy-disable-next-line no-empty-pattern in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
eslint no-empty-pattern full