no-loop-func
Disallow function declarations that contain unsafe references inside loop statements.
This rule extends the base eslint/no-loop-func
rule.
It adds support for TypeScript types.
Options
See eslint/no-loop-func
's options.
How to Use
- Flat Config
- Legacy Config
eslint.config.mjs
export default tseslint.config({
rules: {
// Note: you must disable the base rule as it can report incorrect errors
"no-loop-func": "off",
"@typescript-eslint/no-loop-func": "error"
}
});
.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"no-loop-func": "off",
"@typescript-eslint/no-loop-func": "error"
}
};
Try this rule in the playground ↗