From 9c03c3ef19c67bef4ef6456589e1b6c87b2c6813 Mon Sep 17 00:00:00 2001 From: Cameron Knight Date: Mon, 20 Jan 2020 14:11:42 -0800 Subject: [PATCH] formatReactElementNode: convert displayName to String If the `displayName` for a component turns out to be a `symbol` for some reason, ECMAScript will fail early when trying to implicitly convert it to a string. This explicitly converts to a string so that at least execution isn't halted. --- src/formatter/formatReactElementNode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/formatter/formatReactElementNode.js b/src/formatter/formatReactElementNode.js index 4e2d5820c..eb375161f 100644 --- a/src/formatter/formatReactElementNode.js +++ b/src/formatter/formatReactElementNode.js @@ -119,7 +119,7 @@ export default ( tabStop, } = options; - let out = `<${displayName}`; + let out = `<${String(displayName)}`; let outInlineAttr = out; let outMultilineAttr = out; @@ -203,7 +203,7 @@ export default ( out += '\n'; out += spacer(newLvl - 1, tabStop); } - out += ``; + out += ``; } else { if ( !isInlineAttributeTooLong(