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:
Shrey Banga
2019-08-28 11:03:37 -07:00
committed by Huáng Jùnliàng
parent 94e47c30a9
commit 8a775a32ba
3 changed files with 747 additions and 1 deletions

View 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