It would be great to have an option to have a lint property which will error when the number of parameters exceeds the defined number:
max-num-of-params: 2
goo(a, b) {} // no error
foo(a, b, c) {} // error
@vlio20 parameters-max-number
Tangentially related: #3849
StealingCopying @chelmertz's suggestion from #4203: it would be good to suggest using an object with named parameters once the limit is reached.
I'd be into taking this - would like this rule as well :)
For context, ESLint supports this using 'max-params':
https://eslint.org/docs/rules/max-params
Somewhat relevant: TypeScript has a built-in refactoring to fix this! https://github.com/Microsoft/TypeScript/issues/23552
Note: per #4534, this issue will be closed in less than a month if no PR is sent to add the rule. If you _really_ need the rule, custom rules are always an option and can be maintained outside this repo!
TSLint is being deprecated and no longer accepting pull requests for new rules. See #4534. ๐ฑ
If you'd like to see this rule implemented, you have two choices:
๐ It was a pleasure open sourcing with you!
_If you believe this message was posted here in error, please comment so we can re-open the issue!_
๐ค Beep boop! ๐ TSLint is deprecated ๐ _(#4534)_ and you should switch to typescript-eslint! ๐ค
๐ This issue is being locked to prevent further unnecessary discussions. Thank you! ๐
Most helpful comment
I'd be into taking this - would like this rule as well :)