lib/rules/no-unused-vars.js
function isSelfReference(ref, nodes) {
            let scope = ref.from;

            while (scope) {
                if (nodes.indexOf(scope.block) >= 0) {
                    return true;
                }

                scope = scope.upper;
            }

            return false;
        }
function isSelfReference(ref, nodes) {
            let scope = ref.from;

            while (scope) {
                if (nodes.indexOf(scope.block) >= 0) {
                    return true;
                }

                scope = scope.upper;
            }

            return false;
        }
function isSelfReference ( ref , nodes ) { let scope = ref . from ; while ( scope ) { if ( nodes . indexOf ( scope . block ) >= 0 ) { return true ; } scope = scope . upper ; } return false ; }
Determine if an identifier is referencing an enclosing function name.
@param {Reference} ref - The reference to check.
@param {ASTNode[]} nodes - The candidate function nodes.
@returns {boolean} True if it's a self-reference, false if not.
@private
Determine if an identifier is referencing an enclosing function name .