src/content/docs/linter/rules/no-useless-catch-binding.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> ## Summary - Rule available since: `v2.2.3` - Diagnostic Category: [`lint/complexity/noUselessCatchBinding`](/reference/diagnostics#diagnostic-category) - This rule isn't recommended, so you need to enable it. - This rule has an [**unsafe**](/linter/#unsafe-fixes) fix. - The default severity of this rule is [**information**](/reference/diagnostics#information). ## How to configure ```json title="biome.json" { "linter": { "rules": { "complexity": { "noUselessCatchBinding": "error" } } } }## Description
Disallow unused catch bindings.
This rule disallows unnecessary catch bindings in accordance with ECMAScript 2019.
See also: the ECMAScript 2019 “optional catch binding” feature in the language specification.
## Examples
### Invalid
```js
try {
// Do something
} catch (unused) {}
try {
// Do something
} catch ({ unused }) {}
try {
// Do something
} catch ({ unused1, unused2 }) {}
try {
// Do something
} catch (used) {
console.error(used);
}
try {
// Do something
} catch ({ used }) {
console.error(used);
}
try {
// Do something
} catch ({ used, unused }) {
console.error(used);
}
try {
// Do something
} catch {}