Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(rule): add valid-params rule #85

Merged
merged 2 commits into from
Mar 8, 2018

Conversation

macklinu
Copy link
Contributor

@macklinu macklinu commented Feb 6, 2018

Resolves #47

As of now this rule simply checks how many arguments were supplied to the various Promise functions. If the length of arguments is invalid, it will report that as a lint violation. See the tests for examples.

There are a couple of other issues (#3, #60) that I could see being rolled into this valid-params rule. What are your thoughts on that? I think those could be separate PRs, but some feedback on those ideas being included in this rule / any rule would be great. 👍

@xjamundx
Copy link
Contributor

xjamundx commented Feb 6, 2018

@macklinu I can't remember if you're already a maintainer on this project or not, but I don't really have time to maintain this anymore. Do you want to to be added as an admin and given NPM access?

Copy link
Contributor Author

@macklinu macklinu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts 🗣

README.md Outdated
* `Promise.reject()` is called with 2+ arguments
* `Promise.then()` is called with 0 or 3+ arguments
* `Promise.catch()` is called with 0 or 2+ arguments
* `Promise.finally()` is called with 0 or 2+ arguments
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I got a little tired of writing the code examples by this point. 😂

Let me know if it would be better to include invalid code examples for each item in this list (similar to the Valid section above).

index.js Outdated
@@ -32,7 +35,8 @@ module.exports = {
'promise/no-promise-in-callback': 'warn',
'promise/no-callback-in-promise': 'warn',
'promise/avoid-new': 'warn',
'promise/no-return-in-finally': 'warn'
'promise/no-return-in-finally': 'warn',
'promise/valid-params': 'warn'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this to the recommended config as a warning. Thoughts on making this an error instead?

meta: {
docs: {
description: '',
url: ''
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update this and force push up.

@macklinu
Copy link
Contributor Author

macklinu commented Feb 6, 2018

@xjamundx I'm not a maintainer currently but would be glad to have that access and contribute in that way. Thank you! 😄

@macklinu
Copy link
Contributor Author

macklinu commented Feb 7, 2018

Just accepted the invite for push access. Thank you @xjamundx! 🎉

@xjamundx
Copy link
Contributor

xjamundx commented Feb 7, 2018

Sure @macklinu I'll grant you NPM access after a bit. Try to go through the existing issues. You can do whatever you want. And please add your name to the README as a contribute or maintainer. I only have about an hour a month to spend on stuff like this at the moment and have mostly moved on to using typed JS to solve my static analysis needs for JS

@xjamundx
Copy link
Contributor

I should probably give you NPM access now. What's your NPM username?

@macklinu
Copy link
Contributor Author

npm username is macklinu

@macklinu macklinu force-pushed the rule/valid-params branch 3 times, most recently from add92f8 to 8dbec40 Compare February 25, 2018 18:26
@macklinu macklinu mentioned this pull request Feb 25, 2018
8 tasks
@macklinu
Copy link
Contributor Author

I think this is ready to merge. Will leave this open until I'm ready to merge #108 and ship v3.7.0 early this week / in case anyone has feedback.

@macklinu macklinu merged commit 4782ae5 into eslint-community:master Mar 8, 2018
@macklinu macklinu deleted the rule/valid-params branch March 8, 2018 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants