Single rule that checks code is not more deeply nested than a configurable depth.
A statement is nested deeper than a configurable depth, for example if depth
was set to 8 (the default) then the following code would cause an error:
let dog =
if true then // Depth 1
if true then // Depth 2
if true then // Depth 3
if true then // Depth 4
if true then // Depth 5
if true then // Depth 6
if true then // Depth 7
if true then // Depth 8
() // Depth 9!!
When code becomes too deeply nested it becomes more difficult to read and understand, try to refactor nested code out into functions.
Reduce the depth of the deepest statement, e.g. to fix the example in the "Cause" section you'd take out on level of depth:
let dog =
if true then // Depth 1
if true then // Depth 2
if true then // Depth 3
if true then // Depth 4
if true then // Depth 5
if true then // Depth 6
if true then // Depth 7
() // Depth 8
{
"nestedStatements": {
"enabled": false,
"config": {
"depth": 8
}
}
}