Skip to content

Commit

Permalink
fix: improve check for left node
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Nov 8, 2021
1 parent 875dfac commit 55df3b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rules/prefer-template.js
Expand Up @@ -203,7 +203,7 @@ module.exports = {
const firstToken = sourceCode.getFirstToken(currentNode.left);
const currentNodeText = sourceCode.getText(currentNode);

if (currentNode === currentNode.parent.left) {
if (currentNode.range[0] === currentNode.parent.left.range[0]) {
if (isConcatenation(currentNode.right)) {
const openingParentesisSign = sourceCode.getFirstTokenBetween(currentNode.left, currentNode.right, token => token.value === "(");
const leftNodeText = currentNodeText.slice(0, openingParentesisSign.range[0] - firstToken.range[0]);
Expand Down

0 comments on commit 55df3b3

Please sign in to comment.