question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rule Proposal: require-await

See original GitHub issue

Async 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:closed
  • Created 7 years ago
  • Reactions:14
  • Comments:36 (35 by maintainers)

github_iconTop GitHub Comments

3reactions
btmillscommented, Nov 10, 2016

After discussion in the 2016-11-10 TSC meeting, the team decided to accept this rule into core.

2reactions
nzakascommented, Nov 8, 2016

I don’t think there’s a clear conflict between these two rules. require-await can be resolved by adding an await at a spot other than right after return.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found