π Limit the depth of nested calls.
πΌπ« This rule is enabled in the β
recommended config. This rule is disabled in the βοΈ unopinionated config.
Deeply nested calls make code hard to read. Extract intermediate results to named variables instead.
This rule counts calls and constructor calls passed into other calls or constructors. Fluent receiver chains and JSX wrappers are ignored.
// β
foo(bar(baz(qux())));
// β
const value = baz(qux());
foo(bar(value));// β
query().filter().map().toArray();Type: integer
Default: 3
The maximum allowed nested call depth.
/* eslint unicorn/max-nested-calls: ["error", {"max": 4}] */
// β
foo(bar(baz(qux())));