Fix dangling comments for arrays (#665)
It was missing a softline. I copy and pasted the dangling handling for objects. Fixes #624master
parent
8a27e121ed
commit
c5bfdae5d8
|
@ -712,7 +712,14 @@ function genericPrintNoParens(path, options, print) {
|
|||
case "ArrayPattern":
|
||||
if (n.elements.length === 0) {
|
||||
parts.push(
|
||||
concat(["[", comments.printDanglingComments(path, options), "]"])
|
||||
group(
|
||||
concat([
|
||||
"[",
|
||||
comments.printDanglingComments(path, options),
|
||||
softline,
|
||||
"]"
|
||||
])
|
||||
)
|
||||
);
|
||||
} else {
|
||||
const lastElem = util.getLast(n.elements);
|
||||
|
|
|
@ -74,6 +74,32 @@ declare class Foo extends Qux<string> {/* dangling */}
|
|||
"
|
||||
`;
|
||||
|
||||
exports[`test dangling_array.js 1`] = `
|
||||
"expect(() => {}).toTriggerReadyStateChanges([
|
||||
// Nothing.
|
||||
]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
expect(() => {}).toTriggerReadyStateChanges(
|
||||
[
|
||||
// Nothing.
|
||||
]
|
||||
);
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test dangling_array.js 2`] = `
|
||||
"expect(() => {}).toTriggerReadyStateChanges([
|
||||
// Nothing.
|
||||
]);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
expect(() => {}).toTriggerReadyStateChanges(
|
||||
[
|
||||
// Nothing.
|
||||
]
|
||||
);
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`test first-line.js 1`] = `
|
||||
"a // comment
|
||||
b
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
expect(() => {}).toTriggerReadyStateChanges([
|
||||
// Nothing.
|
||||
]);
|
Loading…
Reference in New Issue