{"record":{"id":"1212d76f77104f0d","repo":"oxc-project/oxc","slug":"move-keyword-inside-the-block-statement","errorCode":null,"errorMessage":"Move `{keyword}` inside the block statement.","messagePattern":"Move `(.+?)` inside the block statement\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/switch_case_break_position.rs","lineNumber":9,"sourceCode":"use oxc_ast::{AstKind, ast::Statement};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\n\nuse crate::{AstNode, context::LintContext, rule::Rule};\n\nfn switch_case_break_position_diagnostic(span: Span, keyword: &str) -> OxcDiagnostic {\n    OxcDiagnostic::warn(format!(\"Move `{keyword}` inside the block statement.\")).with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct SwitchCaseBreakPosition;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforce consistent `break`/`return`/`continue`/`throw` position in `case` clauses.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Enforce that terminating statements (`break`, `return`, `continue`, `throw`) appear inside the block statement of a `case` clause, not after it.\n    /// This can happen when refactoring — for example, removing an `if` wrapper but leaving the `break` outside the braces.\n    ///\n    /// ### Examples\n    ///\n    /// Examples of **incorrect** code for this rule:","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/switch_case_break_position.rs#L1-L27","documentation":"Emitted by the unicorn/switch-case-break-position rule when a `break`, `return`, `continue`, or `throw` statement sits directly in a case clause that has braces, instead of inside the block statement. The rule enforces a consistent position so control flow is visually unambiguous.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/switch_case_break_position.rs:9 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Move the `break`/`return`/`continue`/`throw` statement inside the braces of the block statement"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}