@@ -25,7 +25,6 @@ const { getLast, getPreferredQuote } = require("../../common/util.js");
2525const {
2626 isJsxNode,
2727 rawText,
28- isLiteral,
2928 isCallExpression,
3029 isStringLiteral,
3130 isBinaryish,
@@ -279,7 +278,7 @@ function printJsxChildren(
279278 const parts = [ ] ;
280279 path . each ( ( childPath , i , children ) => {
281280 const child = childPath . getValue ( ) ;
282- if ( isLiteral ( child ) ) {
281+ if ( child . type === "JSXText" ) {
283282 const text = rawText ( child ) ;
284283
285284 // Contains a non-whitespace character
@@ -812,7 +811,7 @@ function isEmptyJsxElement(node) {
812811 // if there is one text child and does not contain any meaningful text
813812 // we can treat the element as empty.
814813 const child = node . children [ 0 ] ;
815- return isLiteral ( child ) && ! isMeaningfulJsxText ( child ) ;
814+ return child . type === "JSXText" && ! isMeaningfulJsxText ( child ) ;
816815}
817816
818817// Meaningful if it contains non-whitespace characters,
@@ -823,7 +822,7 @@ function isEmptyJsxElement(node) {
823822 */
824823function isMeaningfulJsxText ( node ) {
825824 return (
826- isLiteral ( node ) &&
825+ node . type === "JSXText" &&
827826 ( containsNonJsxWhitespaceRegex . test ( rawText ( node ) ) ||
828827 ! / \n / . test ( rawText ( node ) ) )
829828 ) ;
@@ -833,7 +832,7 @@ function isMeaningfulJsxText(node) {
833832function isJsxWhitespaceExpression ( node ) {
834833 return (
835834 node . type === "JSXExpressionContainer" &&
836- isLiteral ( node . expression ) &&
835+ isStringLiteral ( node . expression ) &&
837836 node . expression . value === " " &&
838837 ! hasComment ( node . expression )
839838 ) ;
0 commit comments