Retain trailing comments in array expressions (#10369)
* Retain trailing comments in array expressions This is a proposed fix for https://github.com/babel/babel/issues/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
This commit is contained in:
committed by
Huáng Jùnliàng
parent
94e47c30a9
commit
8a775a32ba
18
packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js
vendored
Normal file
18
packages/babel-parser/test/fixtures/comments/basic/array-expression-trailing-comma/input.js
vendored
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user