-
-
Notifications
You must be signed in to change notification settings - Fork 92
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
always-return should ignore the last then #59
Comments
I kind of need to think about this. At some point you do want to do something with the data, so sure, but in general it's nice to always return something. I don't know @nolanlawson do you have any thoughts on this? |
I agree. I can't use eslint with promise/always-return enabled now.
const x = X();
doSomethingWith(x)
return x; If anything, I think a rule to ensure that you don't return in the last call (like "no-useless-return" but for promises) would be fitting. I respect that this might be a challenging change, or that you may lack the time or interest however. |
This is an interesting idea and one that would be nice to explore in the PRs are definitely welcome! |
This would be great! Thanks for considering! |
This is a bit too strong for us: In most cases we use async/await anyways, and when using .then/.catch/.finally it is usually because either the operation should _not_ block the main result, and/or the handling ultimately leads to a void value. See also eslint-community/eslint-plugin-promise#59 for a discussion that uses a similar example.
🎉 This issue has been resolved in version 6.1.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Taking the example from the linked article and extending it a bit:
There's no need to return anything in
finalThen
. Would it be possible to ignore these cases (in the last then, when the promise isn't returned or used in any way)?The following would become valid:
The following would remain invalid:
The text was updated successfully, but these errors were encountered: