no-empty-pattern
What it does
Section titled “What it does”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.
Why it matters
Section titled “Why it matters”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 =.
Example
Section titled “Example”...var g = () => {};...class K { static {} }var {} = o, [] = p, [,] = q, { a: {} } = r;({} = o);...Configuration
Section titled “Configuration”js: lint: rules: no-empty-pattern: warn # off, warn (default), errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint | no-empty-pattern |
full |