Skip to content

Commit 72c7503

Browse files
committed
fix(formatter): correct checking function composition when the arguments have an call expression before function (#14655)
1 parent 2b645e2 commit 72c7503

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

crates/oxc_formatter/src/write/call_arguments.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,9 @@ pub fn is_function_composition_args(args: &[Argument<'_>]) -> bool {
180180
};
181181
}
182182
Argument::CallExpression(call) => {
183-
return is_call_expression_with_arrow_or_function(call);
183+
if is_call_expression_with_arrow_or_function(call) {
184+
return true;
185+
}
184186
}
185187
_ => {}
186188
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
foo(
2+
'foo',
3+
() => 'bar',
4+
ref('baz'),
5+
computed(() => 'hi'),
6+
);
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
source: crates/oxc_formatter/tests/fixtures/mod.rs
3+
---
4+
==================== Input ====================
5+
foo(
6+
'foo',
7+
() => 'bar',
8+
ref('baz'),
9+
computed(() => 'hi'),
10+
);
11+
12+
==================== Output ====================
13+
foo(
14+
"foo",
15+
() => "bar",
16+
ref("baz"),
17+
computed(() => "hi"),
18+
);
19+
20+
===================== End =====================

0 commit comments

Comments
 (0)