max-params
Configuration
rslint.config.ts
Rule Details
This rule enforces a maximum number of parameters allowed in function definitions.
Examples of incorrect code for this rule with the default { "max": 3 }
option:
Examples of correct code for this rule with the default { "max": 3 }
option:
Options
This rule accepts a number (the maximum allowed) or an object with the following properties:
max(default3): the maximum number of parameters allowed.countThis(default"except-void"): TypeScript-only handling forthisdeclarations. Use"always"to countthis,"never"to ignore it, or"except-void"to ignore onlythis: void.maximum: deprecated alias formax. When both keys are present andmaximumis truthy,maximumwins (matching ESLint'soption.maximum || option.maxcoercion).countVoidThis: deprecated alias forcountThis.truemaps to"always"andfalsemaps to"except-void".
max
Examples of incorrect code for this rule with { "max": 2 }:
Examples of correct code for this rule with { "max": 2 }:
countThis
Examples of correct TypeScript code for this rule with
{ "max": 2, "countThis": "never" }:
Examples of incorrect TypeScript code for this rule with
{ "max": 2, "countThis": "always" }: