How to warn when you forget to `await` an async function in Javascript?

I think OP is looking for something like no-floating-promises from tslint see: https://palantir.github.io/tslint/rules/no-floating-promises/


Setup better eslint integration with webpack, repo, and code editor.
Here is the applicable rule, require await.

Consider integrating the following:

  • eslint loader for webpack-level reporting
  • eslint command line for CI/CD and local lint coverage
  • code editor inline linting

The no-floating-promises ESLint rule requires you to explicitly handle any promises (e.g. with await or void).

Here's a minimal .eslintrc for use with TypeScript. Note that parserOptions is required for this rule:

{
  "root": true,
  "parser": "@typescript-eslint/parser",
  "parserOptions": { "project": "./tsconfig.json" },
  "plugins": ["@typescript-eslint"],
  "extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
  "rules": {
    "@typescript-eslint/no-floating-promises": ["error"]
  }
}

(ESLint is recommended since TSLint has been deprecated.)

(Credit to @zaboco's comment)