async
/await
is a clearer pattern to follow than using callbacks.
ES2017's async
/await
makes it easier to deal with asynchronous code than the
callback pattern.
Examples of incorrect code for this rule:
cb()
callback()
doSomething(arg, (err) => {})
function doSomethingElse(cb) {}
Examples of correct code for this rule:
await doSomething(arg)
async function doSomethingElse() {}
yield yieldValue(err => {})
eventEmitter.on('error', err => {})
If you are not targeting an ES2017 or higher environment and cannot transpile
async
/await
, you should disable this rule.