{"record":{"id":"787631f7002b1a37","repo":"oxc-project/oxc","slug":"unexpected-block-statement-surrounding-arrow-body","errorCode":null,"errorMessage":"Unexpected block statement surrounding arrow body.","messagePattern":"Unexpected block statement surrounding arrow body\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/oxc_linter/src/rules/eslint/arrow_body_style.rs","lineNumber":28,"sourceCode":"use oxc_macros::declare_oxc_lint;\nuse oxc_span::{GetSpan, Span};\nuse oxc_syntax::operator::BinaryOperator;\n\nuse crate::{\n    AstNode,\n    context::LintContext,\n    fixer::{RuleFix, RuleFixer},\n    rule::{Rule, TupleRuleConfig},\n};\n\nfn expected_block_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Expected block statement surrounding arrow body.\")\n        .with_help(\"Surround the arrow body with braces and use a return statement.\")\n        .with_label(span)\n}\n\nfn unexpected_block_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected block statement surrounding arrow body.\")\n        .with_help(\"Move the returned value to be immediately after the `=>`.\")\n        .with_label(span)\n}\n\nfn unexpected_empty_block_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected empty block statement surrounding arrow body.\")\n        .with_help(\"Put a value of `undefined` immediately after the `=>`.\")\n        .with_label(span)\n}\n\n/// Diagnostic that is emitted when we don't have a specific help message to provide\nfn unexpected_block_with_unknown_help_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"Unexpected block statement surrounding arrow body.\").with_label(span)\n}\n\n#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]\n#[serde(rename_all = \"kebab-case\")]\nenum Mode {","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/arrow_body_style.rs#L10-L46","documentation":"Lint diagnostic from eslint/arrow-body-style (unexpected_block_diagnostic, as-needed mode): an arrow function body is wrapped in braces for a single expression. In as-needed mode braces are only required when the body is not a single expression, so the block is unnecessary noise.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/eslint/arrow_body_style.rs:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the braces and return: (x) => x","Apply the rule's autofix"],"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"}