Skip to content

Commit

Permalink
Update avoid-capture.js
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 14, 2020
1 parent 76b14da commit b0ea4ac
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rules/utils/avoid-capture.js
Expand Up @@ -29,8 +29,11 @@ const nameCollidesWithArgumentsSpecial = (name, scopes, isStrict) => {
};

/*
Unresolved reference is probably from the global scope, should avoid use that name, like `foo` and `bar` bellow
Unresolved reference is probably from the global scope. We should avoid using that name.
For example, like `foo` and `bar` below.
```
function unicorn() {
return foo;
}
Expand All @@ -40,6 +43,7 @@ function unicorn() {
return bar;
};
}
```
*/
const isUnresolvedName = (name, scopes) => scopes.some(scope =>
scope.references.some(reference => reference.identifier && reference.identifier.name === name && !reference.resolved) ||
Expand Down

0 comments on commit b0ea4ac

Please sign in to comment.