---
source: crates/oxc_linter/src/tester.rs
expression: no_case_declarations
---
  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { case 1: let x = 1; break; }
   ·                      ───
   ╰────

  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { default: let x = 2; break; }
   ·                       ───
   ╰────

  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { case 1: const x = 1; break; }
   ·                      ─────
   ╰────

  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { default: const x = 2; break; }
   ·                       ─────
   ╰────

  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { case 1: function f() {} break; }
   ·                      ────────
   ╰────

  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { default: function f() {} break; }
   ·                       ────────
   ╰────

  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { case 1: class C {} break; }
   ·                      ─────
   ╰────

  ⚠ eslint(no-case-declarations): Unexpected lexical declaration in case block.
   ╭─[no_case_declarations.tsx:1:1]
 1 │ switch (a) { default: class C {} break; }
   ·                       ─────
   ╰────


