Don't default print comments for JSXFragments (#3398)

master
Lucas Duailibe 2017-12-05 08:41:45 -02:00 committed by GitHub
parent f3e7ca2210
commit 66c9315d13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -5105,7 +5105,7 @@ function printAstToDoc(ast, options, addAlignmentSize) {
// UnionTypeAnnotation has to align the child without the comments
let res;
if (
((node && node.type === "JSXElement") ||
((node && isJSXNode(node)) ||
(parent &&
(parent.type === "JSXSpreadAttribute" ||
parent.type === "JSXSpreadChild" ||

View File

@ -33,6 +33,11 @@ exports[`fragment.js 1`] = `
</>
</div>;
foo = (
// comment
<></>
);
</* open fragment */>
<Component />
<Component />
@ -75,6 +80,11 @@ exports[`fragment.js 1`] = `
</>
</div>;
foo = (
// comment
<></>
);
</* open fragment */>
<Component />
<Component />

View File

@ -30,6 +30,11 @@
</>
</div>;
foo = (
// comment
<></>
);
</* open fragment */>
<Component />
<Component />