Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/oxc_formatter/src/write/call_arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ impl<'a> Format<'a> for AstNode<'a, ArenaVec<'a, Argument<'a>>> {
);
}

let has_empty_line =
self.iter().any(|arg| f.source_text().get_lines_before(arg.span(), f.comments()) > 1);
let has_empty_line = self
.iter()
.skip(1)
.any(|arg| f.source_text().get_lines_before(arg.span(), f.comments()) > 1);
if has_empty_line
|| (!matches!(self.parent.parent(), AstNodes::Decorator(_))
&& is_function_composition_args(self))
Expand Down
9 changes: 9 additions & 0 deletions crates/oxc_formatter/tests/fixtures/js/calls/blank-line.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
gen

("a");

gen

(

"b");
19 changes: 19 additions & 0 deletions crates/oxc_formatter/tests/fixtures/js/calls/blank-line.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
source: crates/oxc_formatter/tests/fixtures/mod.rs
---
==================== Input ====================
gen

("a");

gen

(

"b");
==================== Output ====================
gen("a");

gen("b");

===================== End =====================
4 changes: 1 addition & 3 deletions tasks/coverage/snapshots/formatter_babel.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ commit: 41d96516

formatter_babel Summary:
AST Parsed : 2423/2423 (100.00%)
Positive Passed: 2420/2423 (99.88%)
Positive Passed: 2421/2423 (99.92%)
Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js

Mismatch: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2015/class/division/input.js

Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/top-level-await-unambiguous/module/input.js
`await` is only allowed within async functions and at the top levels of modules
Loading