# prefer-single-object-destructuring

Rule `unicorn/prefer-single-object-destructuring`. Prefer a single object destructuring declaration per local const source.

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/prefer-single-object-destructuring` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/prefer-single-object-destructuring.md) |

## Code examples

### Incorrect: the rule reports this

```js
const foo = {};
const {bar} = foo;
const {baz} = foo;
```

```js
const foo = getFoo();
const {bar, baz} = foo;
```

### Correct: the rule accepts this

```js
const foo = {};
const {bar, baz} = foo;
```

```js
const {bar, baz} = getFoo();
```

```js
let foo = {};
const {bar} = foo;
const {baz} = foo;
```

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-single-object-destructuring": "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% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/prefer-simple-condition-first](https://lintradar.dev/rules/unicorn/prefer-simple-condition-first.md): Prefer simple conditions first in logical expressions.
- [unicorn/prefer-smaller-scope](https://lintradar.dev/rules/unicorn/prefer-smaller-scope.md): Prefer declaring variables and type aliases in the smallest possible scope.
- [unicorn/prefer-scoped-selector](https://lintradar.dev/rules/unicorn/prefer-scoped-selector.md): Prefer `:scope` when using element query selector methods.
- [unicorn/prefer-then-catch](https://lintradar.dev/rules/unicorn/prefer-then-catch.md): Prefer `.then().catch()` over `.then(…, …)` for error handling.
- [unicorn/prefer-regexp-exec](https://lintradar.dev/rules/unicorn/prefer-regexp-exec.md): Prefer `RegExp#exec()` over `String#match()` for non-global regular expressions.
- [unicorn/prefer-type-literal-last](https://lintradar.dev/rules/unicorn/prefer-type-literal-last.md): Require type literals to be last in union types.

---

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