eslint/rules/async
Async code: Promises, async / await, timers and generators: nothing floating, nothing forgotten. Rules of ESLint, typescript-eslint and SonarJS (the Sonar way profile of SonarQube) on this subject, every rule listed; the TypeScript rules apply to TypeScript files only.
22 rules, 18 on. Source: lint/eslint/rules/async.mjs.
| Rule | Setting | Files | What it checks | Why |
|---|---|---|---|---|
no-async-promise-executor | error | JS + TS | Disallow using an async function as a Promise executor | — |
no-await-in-loop | warn | JS + TS | Disallow await inside of loops | Warn: some awaits must run one after the other (ordered writes, rate limits). |
no-promise-executor-return | error | JS + TS | Disallow returning values from Promise executor functions | — |
require-atomic-updates | off | JS + TS | Disallow assignments that can lead to race conditions due to usage of await or yield | Off: false positives with async/await (removed from eslint:recommended). |
prefer-promise-reject-errors | error | JS + TS | Require using Error objects as Promise rejection reasons | Replaced by the TS version. |
require-await | warn | JS + TS | Disallow async functions which have no await expression | Replaced by the TS version. |
require-yield | warn | JS + TS | Require generator functions to contain yield | — |
sonarjs/generator-without-yield | off | JS + TS | Generators should explicitly "yield" a value | Off: duplicate of require-yield. |
sonarjs/disabled-timeout | error | JS + TS | Disabling Mocha timeouts should be explicit | — |
sonarjs/no-async-constructor | error | JS + TS | Constructors should not contain asynchronous operations | — |
sonarjs/no-floating-point-equality | error | JS + TS | Floating point numbers should not be tested for equality | — |
sonarjs/no-try-promise | error | JS + TS | Promise rejections should not be caught by "try" blocks | — |
sonarjs/prefer-promise-shorthand | warn | JS + TS | Shorthand promises should be used | — |
@typescript-eslint/await-thenable | error | TS | Disallow awaiting a value that is not a Thenable | — |
@typescript-eslint/no-floating-promises | error | TS | Require Promise-like statements to be handled appropriately | — |
@typescript-eslint/no-misused-promises | error | TS | Disallow Promises in places not designed to handle them | — |
prefer-promise-reject-errors | off | TS | Require using Error objects as Promise rejection reasons | Replaced by the TS version. |
@typescript-eslint/prefer-promise-reject-errors | error | TS | Require using Error objects as Promise rejection reasons | — |
@typescript-eslint/promise-function-async | error | TS | Require any function or method that returns a Promise to be marked async | — |
require-await | off | TS | Disallow async functions which have no await expression | Replaced by the TS version. |
@typescript-eslint/require-await | warn | TS | Disallow async functions which do not return promises and have no await expression | — |
@typescript-eslint/return-await | error | TS | Enforce consistent awaiting of returned promises | — |