src/content/docs/linter/rules/no-empty-pattern.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> ## Summary - Rule available since: `v1.0.0` - Diagnostic Category: [`lint/correctness/noEmptyPattern`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule doesn't have a fix. - The default severity of this rule is [**error**](/reference/diagnostics#error). - Sources: - Same as [`no-empty-pattern`](https://eslint.org/docs/latest/rules/no-empty-pattern){
"linter": {
"rules": {
"correctness": {
"noEmptyPattern": "error"
}
}
}
}
Disallows empty destructuring patterns.
var {} = foo;
var {a: {}} = foo;
function foo({}) {}
The following cases are valid because they create new bindings.
var {a = {}} = foo;
var {a, b = {}} = foo;
var {a = []} = foo;
function foo({a = {}}) {}
function foo({a = []}) {}
var [a] = foo;