Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 962 Bytes

no-direct-await.md

File metadata and controls

35 lines (26 loc) · 962 Bytes

Enforces using an await handler before every await (no-throw-await/no-direct-await)

🔧💡 This rule is automatically fixable by the --fix CLI option and manually fixable by editor suggestions.

The goal of this rule is to provide a way of error handling that is similar to golang. Why?

Rule Details

This rule aims to enforces using of an await handler before every await

Examples of incorrect code for this rule:

// 1
await someAsyncFunc()
// 2
const aPromise = new Promise()
await aPromise
// 3
await new Promise()

Examples of correct code for this rule:

// 1
await awaitable(someAsyncFunc())
// 2
const aPromise = new Promise()
await awaitable(aPromise)
// 3
await awaitable(new Promise())