{"record":{"id":"e3266418b043ea71","repo":"oxc-project/oxc","slug":"expected-block-statement-surrounding-arrow-body","errorCode":null,"errorMessage":"Expected block statement surrounding arrow body.","messagePattern":"Expected 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":22,"sourceCode":"\nuse oxc_ast::{\n    AstKind,\n    ast::{ArrowFunctionExpression, Expression, ReturnStatement, Statement},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse 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 {","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/eslint/arrow_body_style.rs#L4-L40","documentation":"Lint diagnostic from eslint/arrow-body-style in 'always' mode: an arrow function uses a concise expression body instead of a block statement, violating the configured style that all arrow bodies be brace-wrapped with an explicit return.","triggerScenarios":"Thrown at crates/oxc_linter/src/rules/eslint/arrow_body_style.rs:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap the body in braces and return the expression: (x) => { return x; }","Apply the rule's autofix","Change the rule option to as-needed if expression bodies are preferred"],"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"}