max-params
Configuration
Enforce a maximum number of parameters in function definitions.
Rule Details
Functions that take many parameters are usually harder to read and maintain than functions that take fewer. This rule reports any function whose parameter list exceeds the configured maximum (default 3).
The typescript-eslint variant adds the countVoidThis option for the TypeScript
this: void parameter, which is a type annotation rather than a real argument.
By default, this: void is excluded from the parameter count.
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
The rule accepts an options object:
max(default3): the maximum number of parameters allowed.maximum: deprecated alias formax.countVoidThis(defaultfalse): iftrue, count athis: voidparameter toward the limit.
Examples of incorrect code with { "max": 2 }:
Examples of correct code with { "max": 2 }:
Examples of incorrect code with { "countVoidThis": true, "max": 2 }: