Content-Length: 300121 | pFad | https://github.com/typescript-eslint/typescript-eslint/issues/2693

91 disallow duplicate enum values · Issue #2693 · typescript-eslint/typescript-eslint · GitHub
Skip to content

disallow duplicate enum values #2693

@osdiab

Description

@osdiab

Someone requested it back in the TSLint days at palantir/tslint#3652 , i'm interested in it now

not following the template since it seems to be geared for issues with existing rules.

It would be nice to have a check for enums where two keys have the same value, at least for literal enums (this wouldn't work with enums that have dynamic values, but i don't use any of those, so it's fine with me). I don't have any use for that kind of enum in my codebase and it opens the potential for confusing behavior if it is present.

I haven't made a rule fresh before but I'll try giving it a go if maintainers are cool with this idea.

// bad
enum Foo {
  A = "A",
  B = "A"
}

// good
enum Foo {
  A = "A",
  B = "B"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancement: new plugin ruleNew rule request for eslint-pluginpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://github.com/typescript-eslint/typescript-eslint/issues/2693

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy