Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-await-in-async

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-await-in-async

This rule disallows using await expression outside async functions. See [microsoft/TypeScript#38847](https://github.com/microsoft/TypeScript/issues/38847).

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

eslint-plugin-await-in-async

This rule disallows using await expression outside async functions. See microsoft/TypeScript#38847.

Usage

npm i -D eslint-plugin-await-in-async
module.exports = {
  extends: [
    'plugin:await-in-async/base'
  ]
}

Rule Details

Examples of incorrect code for this rule:

/* eslint await-in-async/await-in-async: "error" */

await foo;

function foo() {
  await bar;
}

async function foo() {
  const bar = () => {
    await baz;
  }
}

Examples of correct code for this rule:

/* eslint await-in-async/await-in-async: "error" */

async function foo() {
  await bar;
}

function foo() {
  const bar = async () => {
    await baz;
  }
}

Options

This rule has an object option for exceptions:

  • topLevelAwait: 'allow' allows top-level await

topLevelAwait

Examples of additional correct code for this rule with the { "topLevelAwait": "allow" } option:

/* eslint await-in-async/await-in-async: ["error", { "topLevelAwait": "allow" }] */
await foo;

FAQs

Package last updated on 06 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc