1.0.3 • Published 7 years ago

eslint-plugin-async-must-await v1.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

eslint-plugin-async-must-await

eslint-plugin-async-must-await

Installation

You'll first need to install ESLint:

$ npm i eslint --save-dev

Next, install eslint-plugin-async-must-await:

$ npm install eslint-plugin-async-must-await --save-dev

Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-async-must-await globally.

Usage

Add async-must-await to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:

{
    "plugins": [
        "async-must-await"
    ]
}

Then configure the rules you want to use under the rules section.

{
    "rules": {
        "async-must-await/rule-name": 2
    }
}

Rules

async-must-await/async-must-await

Invalid code: (since getResultAsync is called without await)

async function getResultAsync() {};
async function submit() {
  getResultAsync();
}

Valid code:

async function getResultAsync() {};
async function submit() {
  await getResultAsync();
}
  • Fill in provided rules here