# rest-spread-spacing

Rule `eslint/rest-spread-spacing`. Enforce spacing between rest and spread operators and their expressions

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Deprecated: yes
- Reach: 17.8M weekly downloads of presets that enable it
- Trend: +4.9% last quarter
- Rank: #639 by reach, #1520 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `rest-spread-spacing` | no | safe | package `eslint` | [docs](https://eslint.org/docs/latest/rules/rest-spread-spacing) |

## Code examples

### Incorrect: the rule reports this

```js
fn(... args);
[... arr, 4, 5, 6];
let [a, b, ... arr] = [1, 2, 3, 4, 5];
function fn(... args) { console.log(args); }
let { x, y, ... z } = { x: 1, y: 2, a: 3, b: 4 };
let n = { x, y, ... z };
```

```js
fn(...args);
[...arr, 4, 5, 6];
let [a, b, ...arr] = [1, 2, 3, 4, 5];
function fn(...args) { console.log(args); }
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
let n = { x, y, ...z };
```

### Correct: the rule accepts this

```js
fn(...args);
[...arr, 4, 5, 6];
let [a, b, ...arr] = [1, 2, 3, 4, 5];
function fn(...args) { console.log(args); }
let { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
let n = { x, y, ...z };
```

```js
fn(... args);
[... arr, 4, 5, 6];
let [a, b, ... arr] = [1, 2, 3, 4, 5];
function fn(... args) { console.log(args); }
let { x, y, ... z } = { x: 1, y: 2, a: 3, b: 4 };
let n = { x, y, ... z };
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "rest-spread-spacing": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Create React App](https://lintradar.dev/presets/react-app.md) | ESLint | `eslint-config-react-app` | 109 | 4.1M | +4.3% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Google](https://lintradar.dev/presets/google.md) | ESLint | `eslint-config-google` | 60 | 646.4K | +18.9% |

## Related rules

- [eslint/one-var](https://lintradar.dev/rules/eslint/one-var.md): Enforce variables to be declared either together or separately in functions
- [eslint/no-return-assign](https://lintradar.dev/rules/eslint/no-return-assign.md): Disallow assignment operators in `return` statements
- [eslint/no-void](https://lintradar.dev/rules/eslint/no-void.md): Disallow `void` operators
- [eslint/no-restricted-globals](https://lintradar.dev/rules/eslint/no-restricted-globals.md): Disallow specified global variables
- [eslint/yoda](https://lintradar.dev/rules/eslint/yoda.md): Require or disallow "Yoda" conditions
- [eslint/no-new](https://lintradar.dev/rules/eslint/no-new.md): Disallow `new` operators outside of assignments or comparisons

---

Web page: https://lintradar.dev/rules/eslint/rest-spread-spacing. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
