Tslint: [FeatureRequest] limit number of function parameters

Created on 7 Mar 2018  ยท  9Comments  ยท  Source: palantir/tslint

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
Available in ESLint Accepting PRs Rule Suggestion ๐ŸŒน R.I.P. ๐ŸŒน

Most helpful comment

I'd be into taking this - would like this rule as well :)

All 9 comments

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!

๐Ÿ’€ _It's time!_ ๐Ÿ’€

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! ๐Ÿ‘‹

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jacob-robertson picture jacob-robertson  ยท  3Comments

adidahiya picture adidahiya  ยท  3Comments

cateyes99 picture cateyes99  ยท  3Comments

rajinder-yadav picture rajinder-yadav  ยท  3Comments

DanielKucal picture DanielKucal  ยท  3Comments