No Complex Arrow Concise
Require block body on complex concise arrows because chained or nested arrow expressions on a single line become unreadable.
Summary
The no-complex-arrow-concise rule reports arrow functions with concise bodies (no block) that exceed either the nested arrow callback limit or the chained method call limit.
Simple concise arrows are not affected.
Why Use This Rule?
- Prevents long chains of
.filter().map().sort()from being crammed into a single concise arrow. - Limits nested callbacks like
.filter((x) => items.map((y) => ...))that lose readability. - Keeps concise arrows for simple, single-expression cases where they improve readability.
Examples
Configuration
Options
warning
ignoreFiles is an escape hatch for files where this rule genuinely does not apply. It is not intended for routine use.
| Option | Type | Default | Description |
|---|---|---|---|
ignoreFiles | string[] | [] | File patterns to skip. |
maxChainLength | number | 2 | Max chained method calls before block body is required. |
maxNestedArrows | number | 1 | Max nested arrow callbacks before block body is required. |
Autofix
Autofix is not available for this rule. Flagged code must be updated manually.
Troubleshooting
- Simple arrow is flagged — Check if the arrow has nested callbacks or chained calls that exceed the limits. A single
.map()with a nested arrow counts as 1 nested arrow. - Block body arrow is not flagged — The rule only targets concise arrows (no braces). If the arrow already has a block body, it passes.