Skip to content

Commit

Permalink
Improve getPreviousNode
Browse files Browse the repository at this point in the history
  • Loading branch information
fisker committed May 12, 2023
1 parent 10748cc commit 57ad675
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rules/utils/get-previous-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ function getPreviousNode(node, sourceCode) {

for (const property of visitorKeys) {
const value = parent[property];

if (value === node) {
return;
}

if (Array.isArray(value)) {
const index = value.indexOf(node);

Expand Down

0 comments on commit 57ad675

Please sign in to comment.