Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Retain trailing comments in array expressions (#10369)
* Retain trailing comments in array expressions This is a proposed fix for #10368 with a simple test. * Move lastElement in the block where it's used * Test trailing comment after array expression * Don't move comments after the array expression * Retain trailing comment after the array expression
- Loading branch information
Showing
3 changed files
with
747 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const nonTrailing = [ | ||
"One", // One | ||
// Two | ||
"Two" // Three | ||
// Four | ||
] | ||
|
||
const trailingAfterComma = [ | ||
"One", // One | ||
// Two | ||
"Two", // Three | ||
// Four | ||
] | ||
|
||
const trailingAfterArray = [ | ||
"One", // One | ||
// Two | ||
] // Three |
Oops, something went wrong.