diff --git a/src/language-js/print/binaryish.js b/src/language-js/print/binaryish.js index 4caa4725f..22fb959b2 100644 --- a/src/language-js/print/binaryish.js +++ b/src/language-js/print/binaryish.js @@ -4,7 +4,7 @@ const { printComments } = require("../../main/comments"); const { getLast } = require("../../common/util"); const { builders: { concat, join, line, softline, group, indent, align, ifBreak }, - utils: { normalizeParts }, + utils: { cleanDoc }, } = require("../../document"); const { hasLeadingOwnLineComment, @@ -271,9 +271,15 @@ function printBinaryishExpressions( // the other ones since we don't call the normal print on BinaryExpression, // only for the left and right parts if (isNested && hasComment(node)) { - parts = normalizeParts( - printComments(path, () => concat(parts), options).parts + const printed = cleanDoc( + printComments(path, () => concat(parts), options) ); + /* istanbul ignore if */ + if (printed.type === "string") { + parts = [printed]; + } else { + parts = printed.parts; + } } } else { // Our stopping case. Simply print the node normally.