Skip to content

Commit

Permalink
chore: update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Oct 29, 2021
1 parent a596752 commit e5fdb7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rules/prefer-template.js
Expand Up @@ -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}\``;
Expand Down

0 comments on commit e5fdb7c

Please sign in to comment.