File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
crates/oxc_linter/src/rules/eslint Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments