# max-nested-calls

Rule `unicorn/max-nested-calls`. Limit the depth of nested calls.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +28.3% last quarter
- Rank: #1014 by reach, #1269 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
foo(bar(baz(qux())));
```

### Correct: the rule accepts this

```js
const value = baz(qux());
foo(bar(value));
```

```js
query().filter().map().toArray();
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/max-nested-calls": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "unicorn/max-nested-calls": "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/no-null](https://lintradar.dev/rules/unicorn/no-null.md): Disallow the use of the `null` literal.
- [unicorn/no-array-callback-reference](https://lintradar.dev/rules/unicorn/no-array-callback-reference.md): Prevent passing a function reference directly to iterator methods.
- [unicorn/no-nested-ternary](https://lintradar.dev/rules/unicorn/no-nested-ternary.md): Disallow nested ternary expressions.
- [unicorn/consistent-boolean-name](https://lintradar.dev/rules/unicorn/consistent-boolean-name.md): Enforce consistent naming for boolean names.
- [unicorn/explicit-length-check](https://lintradar.dev/rules/unicorn/explicit-length-check.md): Enforce explicitly comparing the `length` or `size` property of a value.
- [unicorn/consistent-json-file-read](https://lintradar.dev/rules/unicorn/consistent-json-file-read.md): Enforce consistent JSON file reads before `JSON.parse()`.

---

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