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.
This rule extends the base eslint/no-dupe-class-members
rule.
It adds support for TypeScript's method overload definitions.
Options
See eslint/no-dupe-class-members
'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-dupe-class-members": "off",
"@typescript-eslint/no-dupe-class-members": "error"
}
});
.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"
}
};
Try this rule in the playground ↗