Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

[FeatureRequest] limit number of function parameters #3760

Closed
vlio20 opened this issue Mar 7, 2018 · 9 comments
Closed

[FeatureRequest] limit number of function parameters #3760

vlio20 opened this issue Mar 7, 2018 · 9 comments

Comments

@vlio20
Copy link

vlio20 commented Mar 7, 2018

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 vlio20 changed the title [FeatureRequest] limit number of methods [FeatureRequest] limit number of function parameters Mar 7, 2018
@listepo-alterpost
Copy link
Contributor

@vlio20 parameters-max-number

@JoshuaKGoldberg
Copy link
Contributor

Tangentially related: #3849

@JoshuaKGoldberg
Copy link
Contributor

StealingCopying @chelmertz's suggestion from #4203: it would be good to suggest using an object with named parameters once the limit is reached.

@lizzzp1
Copy link
Contributor

lizzzp1 commented Feb 3, 2019

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

@ghost
Copy link

ghost commented Mar 27, 2019

For context, ESLint supports this using 'max-params':
https://eslint.org/docs/rules/max-params

@JoshuaKGoldberg
Copy link
Contributor

Somewhat relevant: TypeScript has a built-in refactoring to fix this! microsoft/TypeScript#23552

@JoshuaKGoldberg
Copy link
Contributor

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!

@JoshuaKGoldberg
Copy link
Contributor

💀 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!

@JoshuaKGoldberg
Copy link
Contributor

🤖 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! 👋

@palantir palantir locked and limited conversation to collaborators Mar 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants