max-depth
Configuration
rslint.config.ts
Rule Details
This rule enforces a maximum depth that blocks can be nested to reduce code complexity.
Examples of incorrect code for this rule with the default { "max": 4 } option:
Examples of correct code for this rule with the default { "max": 4 } option:
Options
This rule accepts a number, or an object with max (default: 4). The legacy
maximum key is also accepted for backward compatibility.
Examples of incorrect code for this rule with { "max": 2 }:
Examples of correct code for this rule with { "max": 2 }:
else if chains are treated as a single depth level. Class static blocks reset
the nesting counter — code inside static {} is measured from depth 0.