From b0ea4aca0614875ef7b158b0936a350e78c88378 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sat, 14 Mar 2020 15:25:35 +0800 Subject: [PATCH] Update avoid-capture.js --- rules/utils/avoid-capture.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rules/utils/avoid-capture.js b/rules/utils/avoid-capture.js index a7821c5d58..baea72b399 100644 --- a/rules/utils/avoid-capture.js +++ b/rules/utils/avoid-capture.js @@ -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; } @@ -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) ||