---
source: crates/oxc_linter/src/tester.rs
expression: prefer_literal_enum_member
---
  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:3:12]
 2 │             enum InvalidObject {
 3 │               A = {},
   ·               ──────
 4 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:3:12]
 2 │             enum InvalidArray {
 3 │               A = [],
   ·               ──────
 4 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:3:12]
 2 │             enum InvalidTemplateLiteral {
 3 │               A = `foo ${0}`,
   ·               ──────────────
 4 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:3:12]
 2 │             enum InvalidConstructor {
 3 │               A = new Set(),
   ·               ─────────────
 4 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:3:12]
 2 │             enum InvalidExpression {
 3 │               A = 2 + 2,
   ·               ─────────
 4 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:3:12]
 2 │             enum InvalidExpression {
 3 │               A = delete 2,
   ·               ────────────
 4 │               B = -a,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:4:12]
 3 │               A = delete 2,
 4 │               B = -a,
   ·               ──────
 5 │               C = void 2,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:5:12]
 4 │               B = -a,
 5 │               C = void 2,
   ·               ──────────
 6 │               D = ~2,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:6:12]
 5 │               C = void 2,
 6 │               D = ~2,
   ·               ──────
 7 │               E = !0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:7:12]
 6 │               D = ~2,
 7 │               E = !0,
   ·               ──────
 8 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:7:12]
 6 │               C,
 7 │               V = variable,
   ·               ────────────
 8 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:4:12]
 3 │               A = 'TestStr',
 4 │               B = A,
   ·               ─────
 5 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:5:12]
 4 │               A = 'TestStr',
 5 │               B = Valid.A,
   ·               ───────────
 6 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:7:12]
 6 │               A = 'TestStr',
 7 │               B = Valid.A,
   ·               ───────────
 8 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:5:12]
 4 │               A = 'TestStr',
 5 │               B = { ...a },
   ·               ────────────
 6 │             }
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:3:12]
 2 │             enum Foo {
 3 │               A = 1 << 0,
   ·               ──────────
 4 │               B = 1 >> 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:4:12]
 3 │               A = 1 << 0,
 4 │               B = 1 >> 0,
   ·               ──────────
 5 │               C = 1 >>> 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:5:12]
 4 │               B = 1 >> 0,
 5 │               C = 1 >>> 0,
   ·               ───────────
 6 │               D = 1 | 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:6:12]
 5 │               C = 1 >>> 0,
 6 │               D = 1 | 0,
   ·               ─────────
 7 │               E = 1 & 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:7:12]
 6 │               D = 1 | 0,
 7 │               E = 1 & 0,
   ·               ─────────
 8 │               F = 1 ^ 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:8:12]
 7 │               E = 1 & 0,
 8 │               F = 1 ^ 0,
   ·               ─────────
 9 │               G = ~1,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
    ╭─[prefer_literal_enum_member.tsx:9:12]
  8 │               F = 1 ^ 0,
  9 │               G = ~1,
    ·               ──────
 10 │             }
    ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:4:12]
 3 │             enum Foo {
 4 │               A = x << 0,
   ·               ──────────
 5 │               B = x >> 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:5:12]
 4 │               A = x << 0,
 5 │               B = x >> 0,
   ·               ──────────
 6 │               C = x >>> 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:6:12]
 5 │               B = x >> 0,
 6 │               C = x >>> 0,
   ·               ───────────
 7 │               D = x | 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:7:12]
 6 │               C = x >>> 0,
 7 │               D = x | 0,
   ·               ─────────
 8 │               E = x & 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
   ╭─[prefer_literal_enum_member.tsx:8:12]
 7 │               D = x | 0,
 8 │               E = x & 0,
   ·               ─────────
 9 │               F = x ^ 0,
   ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
    ╭─[prefer_literal_enum_member.tsx:9:12]
  8 │               E = x & 0,
  9 │               F = x ^ 0,
    ·               ─────────
 10 │               G = ~x,
    ╰────
  help: Require all enum members to be literal values.

  ⚠ typescript-eslint(prefer-literal-enum-member): Explicit enum value must only be a literal value (string, number, boolean, etc).
    ╭─[prefer_literal_enum_member.tsx:10:12]
  9 │               F = x ^ 0,
 10 │               G = ~x,
    ·               ──────
 11 │             }
    ╰────
  help: Require all enum members to be literal values.
