Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 487 Bytes

File metadata and controls

40 lines (30 loc) · 487 Bytes

Disallow the use of all enums (no-enum)

This rule disallows the use of all types of TypeScript enums.

Rule Details

Examples of incorrect code for this rule:

enum Foo {
  Bar,
  Baz,
}

const enum Foo {
  Bar = "Bar",
  Baz = "Baz",
}

enum Foo {
  Bar = "BAR",
  Baz = "BAZ",
}

Examples of correct code for this rule:

const Foo = {
  Bar: 0,
  Baz: 1,
} as const;

type Foo = "Bar" | "Baz";

const Foo = {
  Bar: "BAR",
  Baz: "BAZ",
} as const;