Skip to main content

init-declarations

Require or disallow initialization in variable declarations.


此规则扩展了基本 eslint/init-declarations 规则。 它增加了对 TypeScript 的 declare 变量的支持。

英:This rule extends the base eslint/init-declarations rule. It adds support for TypeScript's declare variables.

如何使用

.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"init-declarations": "off",
"@typescript-eslint/init-declarations": "error"
}
};
在线运行试试这个规则 ↗

选项

参见 eslint/init-declarations 选项

资源

摘自 ❤️ ESLint 内核