max-statements
Added in v0.8.1Configuration
Rule Details
This rule enforces a maximum number of statements allowed in function blocks.
Examples of incorrect code for this rule with the default { "max": 10 } option:
Examples of correct code for this rule with the default { "max": 10 } option:
Note that this rule does not apply to class static blocks, and that statements in class static blocks do not count as statements in the enclosing function.
Examples of correct code for this rule with { "max": 2 } option:
Examples of additional correct code for this rule with the { "max": 10 }, { "ignoreTopLevelFunctions": true } options:
ignoreTopLevelFunctions only ignores a function's statement count when it is the single top-level function in the file — for example, a module wrapped entirely in one IIFE. When more than one top-level function exists, each one is still checked individually.