Skip to content

disallows code that will transpile into use of regenerator

License

Notifications You must be signed in to change notification settings

yoavniran/eslint-plugin-no-async

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT License npm version

eslint-plugin-no-async

Disallows code that will transpile into use of regenerator.

If you don't want async/await and generators to be transpiled into use of regenerator-runtime then use this rule.

Installation

#PNPM: 
  $ pnpm add -D eslint-plugin-no-async

#Yarn:
  $ yarn add --dev eslint-plugin-no-async

#NPM:
  $ npm i --save-dev eslint-plugin-no-async

In Flat Configuration (9+):

    import noAsync from "eslint-plugin-no-async";
   
    export default [{
        "plugins": {
            "no-async": noAsync,
        },
        "rules": {
            ...js.configs.recommended.rules,
            "no-async/no-async": [2],

            //with allowGenerators:
            // {
            //     "no-async/no-async": [2, true]
            // }
        }
    }];

In .eslintrc(.js) (Before 9):

{
    "no-async/no-async": [2]    
}

# with allowGenerators:

{
    "no-async/no-async": [2, true]    
}

Details

async function myFunction() {}

const myArrowFunction = async () => {}

function * myGeneratorFunction() { }

All of the examples in the code above will result in the use of regenerator after babel transpiled it.

Options

{
    "no-async/no-async": [<level>, <allowGenerators>]    
}

allowGenerators In case you wish to allow generator functions, set this to true. (default: false)

About

disallows code that will transpile into use of regenerator

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published