# prefer-optional-catch-binding

Rule `unicorn/prefer-optional-catch-binding`. Prefer omitting the `catch` binding parameter.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 12M weekly downloads of presets that enable it
- Trend: +40.1% last quarter
- Rank: #804 by reach, #1000 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/prefer-optional-catch-binding` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/prefer-optional-catch-binding.md) |
| Oxlint | `unicorn/prefer-optional-catch-binding` | no | safe | plugin `unicorn`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/unicorn/prefer-optional-catch-binding.html) |

## Code examples

### Incorrect: the rule reports this

```js
try {
  // do something
} catch (notUsedError) {
  // ignore error
}
```

```js
try {
  await fetch(url);
} catch (error) {
  // error is not used, just continue
}
```

### Correct: the rule accepts this

```js
try {
  // do something
} catch {
  // ignore error
}
```

```js
try {
  await fetch(url);
} catch {
  // ignore fetch errors
}
```

```js
try {
  doSomething();
} catch (error) {
  // error is actually used
  console.log(error.message);
}
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/prefer-optional-catch-binding": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "unicorn/prefer-optional-catch-binding": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.3% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/prefer-number-coercion](https://lintradar.dev/rules/unicorn/prefer-number-coercion.md): Prefer `Number()` over `parseFloat()` and base-10 `parseInt()`.
- [unicorn/prefer-prototype-methods](https://lintradar.dev/rules/unicorn/prefer-prototype-methods.md): Prefer borrowing methods from the prototype instead of the instance.
- [unicorn/prefer-native-coercion-functions](https://lintradar.dev/rules/unicorn/prefer-native-coercion-functions.md): Prefer using `String`, `Number`, `BigInt`, `Boolean`, and `Symbol` directly.
- [unicorn/prefer-reflect-apply](https://lintradar.dev/rules/unicorn/prefer-reflect-apply.md): Prefer `Reflect.apply()` over `Function#apply()`.
- [unicorn/prefer-modern-dom-apis](https://lintradar.dev/rules/unicorn/prefer-modern-dom-apis.md): Prefer modern DOM APIs.
- [unicorn/prefer-response-static-json](https://lintradar.dev/rules/unicorn/prefer-response-static-json.md): Prefer `Response.json()` over `new Response(JSON.stringify())`.

---

Web page: https://lintradar.dev/rules/unicorn/prefer-optional-catch-binding. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
