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

New rule: Must await on promises #11

Open
kastermester opened this issue Sep 19, 2017 · 4 comments
Open

New rule: Must await on promises #11

kastermester opened this issue Sep 19, 2017 · 4 comments
Assignees

Comments

@kastermester
Copy link
Member

In async functions - verify that one of the following happens on every single return value from a function returning a promise - or on arguments that are promise typed:

  • await expression
  • Promise is returned
  • Promise is used as an argument to a different function invocation
@bondo
Copy link
Member

bondo commented Sep 19, 2017

If the function is not async we should also have some verification

@kastermester
Copy link
Member Author

I don't think this is really needed. Usually you will have a single entrypoint being non-async - or simple one liners that just return a promise they call (because that is what the function does). I don't think it is worth trying to fix up on this until we see such needs.

@bondo
Copy link
Member

bondo commented Sep 19, 2017

Why not just ignore if the function is async and use the same logic?
We just have to make sure people can call .then and not get the error. Or just require that they make the function async and await...

@kastermester
Copy link
Member Author

To keep it simple really :) It is not just then that you can call in non async functions that should silence the error. Various promise implementations have various utility methods that does the same thing. I'd rather fix the common case first and then see if we run into problems with non-async functions later, rather than trying to fix everything now and potentially annoy people when they use their own fancy promise library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants