eslint: require-await: allow `async function` with `throw` or `return`?
require-await
as currently written is a terrible rule; there’s zero value in requiring that an async function
have an await
.
However, an async function
that has no await
, no throw
, and no return
truly has no purpose, because it can’t block on anything.
Would you be open to adding an option (or better, changing the default behavior) to this rule so that it only warns on async function
s that lack await+throw+return?
(to be fair, even if it calls a function that throws synchronously, it could still be valuable to have an async function
because it ensures a rejected promise)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 7
- Comments: 17 (15 by maintainers)
🎉 🎊10000th issue! 🎊 🎉
Thanks for your interest in improving ESLint. Unfortunately, it looks like this issue didn’t get consensus from the team, so I’m closing it. We define consensus as having three 👍s from team members, as well as a team member willing to champion the proposal. This is a high bar by design – we can’t realistically accept and maintain every feature request in the long term, so we only accept feature requests which are useful enough that there is consensus among the team that they’re worth adding.
Since ESLint is pluggable and can load custom rules at runtime, the lack of consensus among the ESLint team doesn’t need to be a blocker for you using this in your project, if you’d find it useful. It just means that you would need to implement the rule yourself, rather than using a bundled rule that is packaged with ESLint.
cc @mysticatea since you were in favor of adding the rule awhile ago in https://github.com/eslint/eslint/issues/6820.