# no-array-front-mutation

Rule `unicorn/no-array-front-mutation`. Disallow front-of-array mutation.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #2008 by reach

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
array.shift();
```

```js
array.unshift(item);
```

### Correct: the rule accepts this

```js
for (const item of array) {
  process(item);
}
```

```js
import Queue from 'yocto-queue';

const queue = new Queue();
queue.enqueue(item);
queue.dequeue();
```

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-array-front-mutation": "error",
    },
  },
];
```

## Related rules

- [unicorn/key-name-casing](https://lintradar.dev/rules/unicorn/key-name-casing.md): Enforce a case style for data keys.
- [unicorn/iteration-fallback-style](https://lintradar.dev/rules/unicorn/iteration-fallback-style.md): Enforce a consistent style for optional loop sources.
- [unicorn/no-barrel-files](https://lintradar.dev/rules/unicorn/no-barrel-files.md): Disallow barrel files.
- [unicorn/indent](https://lintradar.dev/rules/unicorn/indent.md): Enforce consistent indentation in JSON and CSS.
- [unicorn/id-match](https://lintradar.dev/rules/unicorn/id-match.md): Require identifiers to match a specified regular expression.
- [unicorn/consistent-function-style](https://lintradar.dev/rules/unicorn/consistent-function-style.md): Enforce function syntax by role.

---

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