{"record":{"id":"9ed666373d3cc7c9","repo":"oxc-project/oxc","slug":"unnecessary-braces-in-case-clause","errorCode":null,"errorMessage":"Unnecessary braces in case clause.","messagePattern":"Unnecessary braces in case clause\\.","errorType":"validation","errorClass":"OxcDiagnostic","httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/unicorn/switch_case_braces.rs","lineNumber":28,"sourceCode":"    ast_util::get_preceding_indent_str,\n    context::LintContext,\n    rule::{DefaultRuleConfig, Rule},\n};\n\nfn switch_case_braces_diagnostic_empty_clause(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected braces in empty case clause.\")\n        .with_help(\"Remove braces in empty case clause.\")\n        .with_label(span)\n}\n\nfn switch_case_braces_diagnostic_missing_braces(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Missing braces in case clause.\")\n        .with_help(\"Add Braces for case clause.\")\n        .with_label(span)\n}\n\nfn switch_case_braces_diagnostic_unnecessary_braces(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unnecessary braces in case clause.\")\n        .with_help(\"Remove Braces for case clause.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Clone, Deserialize)]\npub struct SwitchCaseBraces(Box<SwitchCaseBracesConfig>);\n\nimpl Default for SwitchCaseBraces {\n    fn default() -> Self {\n        Self(Box::new(SwitchCaseBracesConfig::Always))\n    }\n}\n\n#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema, Default)]\n#[serde(rename_all = \"kebab-case\")]\npub enum SwitchCaseBracesConfig {\n    /// Always require braces in case clauses (except empty cases).\n    #[default]","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/unicorn/switch_case_braces.rs#L10-L46","documentation":"Emitted by the unicorn/switch-case-braces rule (with the `convert` option) at a `case` clause that already has braces but whose body would not need them under the configured conversion policy. The braces are considered redundant and should be removed for consistency.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/unicorn/switch_case_braces.rs:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the unnecessary braces from the case clause"],"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-14T00:17:10.932Z"}