> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# no-dupe-class-members

[Added in v0.5.0](https://github.com/web-infra-dev/rslint/releases/tag/v0.5.0)
## Configuration

| Preset                   | Configured Value |
| ------------------------ | ---------------- |
| ✅ js.configs.recommended | `"error"`        |


```ts title=rslint.config.ts
import { defineConfig, js } from '@rslint/core';

export default defineConfig([
  js.configs.recommended,
  {
    rules: {
      'no-dupe-class-members': 'error',
    },
  },
]);
```

## Rule Details

Disallow duplicate names in class members. If there are declarations of the same name in class members, the last declaration silently overwrites the earlier ones, which can cause unexpected behavior.

Examples of **incorrect** code for this rule:

```javascript
class A {
  bar() {}
  bar() {}
}

class B {
  bar() {}
  get bar() {}
}

class C {
  bar;
  bar;
}

class D {
  bar;
  bar() {}
}

class E {
  static bar() {}
  static bar() {}
}
```

Examples of **correct** code for this rule:

```javascript
class A {
  bar() {}
  qux() {}
}

class B {
  get bar() {}
  set bar(value) {}
}

class C {
  bar;
  qux;
}

class D {
  bar;
  qux() {}
}

class E {
  static bar() {}
  bar() {}
}
```

TypeScript method overload signatures are allowed:

```typescript
class A {
  foo(value: string): void;
  foo(value: number): void;
  foo(value: string | number) {}
}
```

## Original Documentation

- [ESLint: no-dupe-class-members](https://eslint.org/docs/latest/rules/no-dupe-class-members)
- [Source code](https://github.com/eslint/eslint/blob/v10.8.1/lib/rules/no-dupe-class-members.js)
