oxc-project/oxc · error
Unexpected empty block statement surrounding arrow body.
Error message
Unexpected empty block statement surrounding arrow body.
What it means
Lint diagnostic from eslint/arrow-body-style: an arrow function body is an empty block statement. An empty block implicitly returns undefined, which reads as a mistake rather than an intentional no-op and is flagged separately from a non-empty block.
Source
Thrown at crates/oxc_linter/src/rules/eslint/arrow_body_style.rs:34
context::LintContext,
fixer::{RuleFix, RuleFixer},
rule::{Rule, TupleRuleConfig},
};
fn expected_block_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Expected block statement surrounding arrow body.")
.with_help("Surround the arrow body with braces and use a return statement.")
.with_label(span)
}
fn unexpected_block_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Unexpected block statement surrounding arrow body.")
.with_help("Move the returned value to be immediately after the `=>`.")
.with_label(span)
}
fn unexpected_empty_block_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Unexpected empty block statement surrounding arrow body.")
.with_help("Put a value of `undefined` immediately after the `=>`.")
.with_label(span)
}
/// Diagnostic that is emitted when we don't have a specific help message to provide
fn unexpected_block_with_unknown_help_diagnostic(span: Span) -> OxcDiagnostic {
OxcDiagnostic::warn("Unexpected block statement surrounding arrow body.").with_label(span)
}
#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize, JsonSchema)]
#[serde(rename_all = "kebab-case")]
enum Mode {
/// Enforces no braces where they can be omitted (default).
#[default]
AsNeeded,
/// Enforces braces around the function body.
Always,
/// Enforces no braces around the function body (constrains arrow functions to the role of returning an expression).View on GitHub (pinned to e1e7af627c)
Solutions
- Return the intended value: () => { return value; }
- Write the body as () => undefined if undefined is truly the intent
- Add the missing implementation
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/oxc_linter/src/rules/eslint/arrow_body_style.rs:34 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/ff649613573b1de9.
Report an issue: GitHub.