0.0.1 • Published 3 years ago
eslint-plugin-no-async-in-for-each-loop v0.0.1
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-devNext, install eslint-plugin-no-async-in-for-each-loop:
npm install eslint-plugin-no-async-in-for-each-loop --save-devUsage
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) })