Rule Proposal: require-await
See original GitHub issueAsync functions and await expressions arrived stage 4. We can add the rule for those after our parser supported those.
This proposal is the await
version of require-yield rule.
It disallows async functions without await expressions.
/*eslint require-await: error*/
//------------------------------------------------------------------------------
// ✔ GOOD
async function foo() {
await doSomething()
}
async function foo() {
// do nothing.
}
//------------------------------------------------------------------------------
// ✘ BAD
async function foo() {
doSomething()
}
Issue Analytics
- State:
- Created 7 years ago
- Reactions:14
- Comments:36 (35 by maintainers)
Top Results From Across the Web
require-await - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Rule proposal: `prefer-await` #1144 - Issuehunt
Proposing a rule to require await when the callee is async . Fail. const a = async () => {}; a(); /* error:...
Read more >require-await | typescript-eslint
This rule extends the base eslint/require-await rule. It uses type information to add support for async functions that return a Promise .
Read more >How can I ensure that functions which "await" are "async"?
https://eslint.org/docs/rules/require-await ?? ... I just joined that sub-reddit & plan to ask how to make the transition :-).
Read more >Tough questions await SEC Chair Gensler as he ... - CNBC
Since then, the agenda has only gotten bigger. Gensler has proposed rules on cybersecurity risk management, loaning and borrowing of securities, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After discussion in the 2016-11-10 TSC meeting, the team decided to accept this rule into core.
I don’t think there’s a clear conflict between these two rules.
require-await
can be resolved by adding anawait
at a spot other than right afterreturn
.