Skip to main content

no-loop-func

禁止在循环语句中包含不安全引用的函数声明.

🧱

This is an "extension" rule that replaces a core ESLint rule to work with TypeScript. See Rules > Extension Rules.

This rule extends the base no-loop-func rule from ESLint core. 它增加了对 TypeScript 类型的支持。

¥It adds support for TypeScript types.

选项

See eslint/no-loop-func's options.

如何使用

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"
}
});

在线运行试试这个规则 ↗

资源

Taken with ❤️ from ESLint core.