no-duplicate-enum-values
JavaScript / TypeScriptsuspiciousno fixdefault: offjs/typescript-eslint-recommendedjs/biome-recommendedjs/oxlint
What it does
Section titled “What it does”Reports an enum member initialised with a string or number that an earlier member of the same enum already has (A = 0, B = 0). Computed values (1 + 1) are not compared.
Why it matters
Section titled “Why it matters”Two names for one value make a value to name lookup (the reverse mapping of a numeric enum) answer with the later one, and the second member is usually a copy-paste mistake with the value not changed.
To fix, give the member its own value.
Example
Section titled “Example”enum E { A = 0, B = 0, C = "c",}Configuration
Section titled “Configuration”js: lint: rules: no-duplicate-enum-values: warn # off (default), warn, errorEnabled by the presets: js/typescript-eslint-recommended, js/biome-recommended, js/oxlint.
Suppress one line with sudsy-disable-next-line no-duplicate-enum-values 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 |
|---|---|---|
| typescript-eslint | no-duplicate-enum-values |
full |