Skip to content

Commit

Permalink
Ensure JSXOpeningElement does not break with single text attr on Baby…
Browse files Browse the repository at this point in the history
…lon (#1229)
  • Loading branch information
existentialism authored and vjeux committed Apr 13, 2017
1 parent 485028c commit 4dfe92a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/printer.js
Expand Up @@ -1296,7 +1296,8 @@ function genericPrintNoParens(path, options, print, args) {
if (
n.attributes.length === 1 &&
n.attributes[0].value &&
n.attributes[0].value.type === "Literal" &&
(n.attributes[0].value.type === "Literal" ||
n.attributes[0].value.type === "StringLiteral") &&
typeof n.attributes[0].value.value === "string"
) {
return group(
Expand Down
2 changes: 1 addition & 1 deletion tests/jsx-newlines/jsfmt.spec.js
@@ -1 +1 @@
run_spec(__dirname, null, ["typescript"]);
run_spec(__dirname, null, ["babylon", "typescript"]);
2 changes: 1 addition & 1 deletion tests/jsx-split-attrs/jsfmt.spec.js
@@ -1 +1 @@
run_spec(__dirname, null, ["typescript"]);
run_spec(__dirname, null, ["babylon", "typescript"]);

0 comments on commit 4dfe92a

Please sign in to comment.