Skip to main content

no-dupe-class-members

Disallow duplicate class members.


danger

The code problem checked by this ESLint rule is automatically checked by the TypeScript compiler. Thus, it is not recommended to turn on this rule in new TypeScript projects. You only need to enable this rule if you prefer the ESLint error messages over the TypeScript compiler error messages.

此规则扩展了基本 eslint/no-dupe-class-members 规则。 它添加了对 TypeScript 方法重载定义的支持。

英:This rule extends the base eslint/no-dupe-class-members rule. It adds support for TypeScript's method overload definitions.

如何使用

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

选项

参见 eslint/no-dupe-class-members 选项

资源

摘自 ❤️ ESLint 内核