# no-return-array-push

Rule `unicorn/no-return-array-push`. Disallow using the return value of `Array#push()` and `Array#unshift()`.

- Source: unicorn
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 40.5M weekly downloads of presets that enable it
- Trend: +81.2% last quarter
- Rank: #450 by reach, #442 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-return-array-push` | no | suggestion | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-return-array-push.md) |
| Biome | `nursery/noReturnArrayPush` | yes | unsafe | group nursery, since 2.6.4 | [docs](https://biomejs.dev/linter/rules/no-return-array-push/) |

## Code examples

### Incorrect: the rule reports this

```js
function add(item) {
  return items.push(item);
}
```

```js
const add = item => items.push(item);
```

```js
const length = items.unshift(item);
```

### Correct: the rule accepts this

```js
function add(item) {
  items.push(item);
  return;
}
```

```js
const add = item => {
  items.push(item);
};
```

```js
items.unshift(item);
const length = items.length;
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/no-return-array-push": "error",
    },
  },
];
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noReturnArrayPush": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/no-late-event-control](https://lintradar.dev/rules/unicorn/no-late-event-control.md): Disallow event-control method calls after the synchronous event dispatch has finished.
- [unicorn/no-unnecessary-splice](https://lintradar.dev/rules/unicorn/no-unnecessary-splice.md): Disallow `Array#splice()` when simpler alternatives exist.
- [unicorn/no-late-current-target-access](https://lintradar.dev/rules/unicorn/no-late-current-target-access.md): Disallow accessing `event.currentTarget` after the synchronous event dispatch has finished.
- [unicorn/no-duplicate-loops](https://lintradar.dev/rules/unicorn/no-duplicate-loops.md): Disallow `.map()` and `.filter()` in `for…of` and `for await…of` loop headers.
- [unicorn/no-confusing-array-splice](https://lintradar.dev/rules/unicorn/no-confusing-array-splice.md): Disallow confusing uses of `Array#{splice,toSpliced}()`.
- [unicorn/prefer-while-loop-condition](https://lintradar.dev/rules/unicorn/prefer-while-loop-condition.md): Prefer putting the condition in the while statement.

---

Web page: https://lintradar.dev/rules/unicorn/no-return-array-push. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
