Skip to content

Rule proposal: disallow mixed string/numeric enums #2694

Closed
@osdiab

Description

@osdiab

Related to #2693 , in my project we only use either purely numeric or purely string enums; i want to discourage my teammates to make enums that have both, since it makes it trickier to get a definite set of enum values from the enum object.

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

// OK
enum Bar {
  A = "A",
  B = "B"
}

enum Baz {
  A,
  B,
  C = 5
}

Metadata

Metadata

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