Skip to main content

no-dupe-class-members

Disallow duplicate class members.

🧱

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

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 no-dupe-class-members rule from ESLint core. It adds support for TypeScript's method overload definitions.

Options

See eslint/no-dupe-class-members's options.

How to Use

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

Try this rule in the playground ↗

Resources

Taken with ❤️ from ESLint core.