no-dupe-class-members
What it does
Section titled “What it does”Reports a class member whose name is already used by another member of the class: two methods, two fields, a field and a method, two getters. A getter with its setter may share a name, and so may a static and an instance member.
Why it matters
Section titled “Why it matters”When two members have one name, the later one silently replaces the earlier, so the first body is dead code. It is usually a copy-paste mistake where the second member was meant to have another name.
To fix, rename one of them or delete the one that is not used.
Example
Section titled “Example”...class A { a() {} a() {} static b() {} b() {} get c() { return 1; } set c(v) {} d = 1; d = 2; ["e"]() {} e() {} }Configuration
Section titled “Configuration”js: lint: rules: no-dupe-class-members: error # off, warn, error (default)Enabled by the presets: js/eslint-recommended, js/biome-recommended, js/oxlint.
Suppress one line with sudsy-disable-next-line no-dupe-class-members in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| eslint | no-dupe-class-members |
full |