Use raw value of JSXText and JSXAttribute (#5256)

This commit is contained in:
Alex Rattray
2017-04-04 06:46:20 -07:00
committed by Daniel Tschinder
parent 878a7c5fdb
commit 348cc5eeff
10 changed files with 112 additions and 1 deletions

View File

@@ -65,6 +65,11 @@ export default function (opts) {
if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) {
value.value = value.value.replace(/\n\s+/g, " ");
// "raw" JSXText should not be used from a StringLiteral because it needs to be escaped.
if (value.extra && value.extra.raw) {
delete value.extra.raw;
}
}
if (t.isValidIdentifier(node.name.name)) {