diff --git a/lib/rules/prefer-template.js b/lib/rules/prefer-template.js index fbd9b5ca339..787a11dfdc7 100644 --- a/lib/rules/prefer-template.js +++ b/lib/rules/prefer-template.js @@ -203,7 +203,10 @@ module.exports = { if (isConcatenation(currentNode) && !hasIdentifierReference(currentNode)) { - // As there are no varibales used in this concatenation, we can sipmly calculate the concatenated string + /* + * As there are no varibales used in this concatenation, we can sipmly calculate the concatenated string + * "'Hello ' + 'world'" -> ["'Hello ' " , " 'world'"] -> ["Hello ", "world"] -> "Hello world" + */ const concatenatedText = sourceCode.getText(currentNode).split("+").map(e => e.trim().slice(1, -1)).join(""); return `\`${concatenatedText}\``;