@kapouer/eslint-plugin-no-return-in-loop
v1.0.0
Published
eslint plugin to report return statements in loop
Downloads
9,011
Readme
eslint-plugin-no-return-in-loop
This plugin reports an error when there is an empty return
in a loop:
Not okay:
for (const n of [1, 2, 3]) {
if (n === 2) return; /* this was surely meant to be `break` or `continue`
}
Okay:
for (const n of [1, 2, 3]) {
if (n === 2) return true;
}
Install:
npm install @kapouer/eslint-plugin-no-return-in-loop
Configure:
"plugins": [
"@babel",
"@kapouer/no-return-in-loop"
],
"rules": {
"@kapouer/no-return-in-loop/no-return-in-loop": "error"
}