Skip to content

Commit 7a508a8

Browse files
committed
simplify
1 parent ca2f09c commit 7a508a8

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

crates/oxc_linter/src/rules/eslint/arrow_body_style.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,13 @@ impl Rule for ArrowBodyStyle {
170170
));
171171
}
172172
if self.mode.is_as_needed() && self.require_return_for_object_literal {
173-
if statements.len() != 1 {
174-
return;
175-
}
176-
let inner_statement = &statements[0];
177-
if let Statement::ExpressionStatement(expression_statement) = inner_statement {
178-
let expr = &expression_statement.expression.without_parentheses();
179-
if matches!(expr, Expression::ObjectExpression(_)) {
180-
ctx.diagnostic(arrow_body_style_diagnostic(
181-
body.span,
182-
"Expected block statement surrounding arrow body.",
183-
));
184-
}
173+
if let Some(Expression::ObjectExpression(_)) =
174+
arrow_func_expr.get_expression().map(Expression::get_inner_expression)
175+
{
176+
ctx.diagnostic(arrow_body_style_diagnostic(
177+
body.span,
178+
"Expected block statement surrounding arrow body.",
179+
));
185180
}
186181
}
187182
} else {

0 commit comments

Comments
 (0)