lib/linter.js
function markVariableAsUsed(scopeManager, currentNode, parserOptions, name) {
    const hasGlobalReturn = parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn;
    const specialScope = hasGlobalReturn || parserOptions.sourceType === "module";
    const currentScope = getScope(scopeManager, currentNode);

    // Special Node.js scope means we need to start one level deeper
    const initialScope = currentScope.type === "global" && specialScope ? currentScope.childScopes[0] : currentScope;

    for (let scope = initialScope; scope; scope = scope.upper) {
        const variable = scope.variables.find(scopeVar => scopeVar.name === name);

        if (variable) {
            variable.eslintUsed = true;
            return true;
        }
    }

    return false;
}
function markVariableAsUsed(scopeManager, currentNode, parserOptions, name) {
    const hasGlobalReturn = parserOptions.ecmaFeatures && parserOptions.ecmaFeatures.globalReturn;
    const specialScope = hasGlobalReturn || parserOptions.sourceType === "module";
    const currentScope = getScope(scopeManager, currentNode);

    // Special Node.js scope means we need to start one level deeper
    const initialScope = currentScope.type === "global" && specialScope ? currentScope.childScopes[0] : currentScope;

    for (let scope = initialScope; scope; scope = scope.upper) {
        const variable = scope.variables.find(scopeVar => scopeVar.name === name);

        if (variable) {
            variable.eslintUsed = true;
            return true;
        }
    }

    return false;
}
function markVariableAsUsed ( scopeManager , currentNode , parserOptions , name ) { const hasGlobalReturn = parserOptions . ecmaFeatures && parserOptions . ecmaFeatures . globalReturn ; const specialScope = hasGlobalReturn || parserOptions . sourceType === "module" ; const currentScope = getScope ( scopeManager , currentNode ) ; // Special Node.js scope means we need to start one level deeper const initialScope = currentScope . type === "global" && specialScope ? currentScope . childScopes [ 0 ] : currentScope ; for ( let scope = initialScope ; scope ; scope = scope . upper ) { const variable = scope . variables . find ( scopeVar => scopeVar . name === name ) ; if ( variable ) { variable . eslintUsed = true ; return true ; } } return false ; }
Marks a variable as used in the current scope
@param {ScopeManager} scopeManager The scope manager for this AST. The scope may be mutated by this function.
@param {ASTNode} currentNode The node currently being traversed
@param {Object} parserOptions The options used to parse this text
@param {string} name The name of the variable that should be marked as used.
@returns {boolean} True if the variable was found and marked as used, false if not.
Marks a variable as used in the current scope