0.0.1 • Published 3 years ago
eslint-plugin-no-async-in-for-each-loop
Licence
ISC
Version
0.0.1
Deps
1
Size
1.9 MB
Vulns
0
Weekly
0
eslint-plugin-no-async-in-for-each-loop
Disallow using async in forEach loops
Installation
You'll first need to install ESLint:
npm i eslint --save-dev
Next, install eslint-plugin-no-async-in-for-each-loop:
npm install eslint-plugin-no-async-in-for-each-loop --save-dev
Usage
Add no-async-in-for-each-loop to the plugins section of your .eslintrc configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": [
"no-async-in-for-each-loop"
]
}
Then configure the rules you want to use under the rules section.
{
"rules": {
"no-async-in-for-each-loop/no-async-in-for-each-loop": 2
}
}
Examples
Valid code :
['gunma'].forEach((prefecutre) => { console.log(prefecutre) })
Invalid code :
['tokyo'].forEach(async (prefecutre) => { console.log(prefecture) })