max-params
eslint
No autofix
eslint.config.js
export default [
{
rules: {
"max-params": "error",
},
},
];function foo1 (bar, baz, qux, qxx) {
doSomething();
}
let foo2 = (bar, baz, qux, qxx) => {
doSomething();
};function hasNoThis(this: void, first: string, second: string) {
// ...
}function hasThis(this: unknown[], first: string, second: string) {
// ...
}function foo1 (bar, baz, qux) {
doSomething();
}
let foo2 = (bar, baz, qux) => {
doSomething();
};function hasNoThis(this: void, first: string, second: string) {
// ...
}function hasThis(this: unknown[], first: string, second: string) {
// ...
}Examples from the ESLint documentation.
max-params
eslint
export default [
{
rules: {
"max-params": "error",
},
},
];max-params
eslint plugin · style
{
"rules": {
"max-params": "error"
}
}complexity/useMaxParams
complexity · since 2.2.0
{
"linter": {
"rules": {
"complexity": {
"useMaxParams": "error"
}
}
}
}Enforce a maximum number of parameters in function definitions
Disallow shorthand type conversions
Enforce a maximum number of lines per file
Enforce or disallow capitalization of the first letter of a comment
Enforce a maximum depth that blocks can be nested
Disallow use of this in contexts where the value of this is undefined