Skip to content

Commit

Permalink
Chore: fix comment location in no-unused-vars (#14648)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjermanovic committed Jun 4, 2021
1 parent e44ce0a commit d709abf
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions lib/rules/no-unused-vars.js
Expand Up @@ -449,18 +449,24 @@ module.exports = {
return ref.isRead() && (

// self update. e.g. `a += 1`, `a++`
(// in RHS of an assignment for itself. e.g. `a = a + 1`
((
(
(
parent.type === "AssignmentExpression" &&
isUnusedExpression(parent) &&
parent.left === id
parent.left === id &&
isUnusedExpression(parent)
) ||
(
parent.type === "UpdateExpression" &&
isUnusedExpression(parent)
)
) ||

// in RHS of an assignment for itself. e.g. `a = a + 1`
(
parent.type === "UpdateExpression" &&
isUnusedExpression(parent)
) || rhsNode &&
isInside(id, rhsNode) &&
!isInsideOfStorableFunction(id, rhsNode)))
rhsNode &&
isInside(id, rhsNode) &&
!isInsideOfStorableFunction(id, rhsNode)
)
);
}

Expand Down

0 comments on commit d709abf

Please sign in to comment.