lib/rules/prefer-const.js
function isOuterVariableInDestructing(name, initScope) {

    if (initScope.through.find(ref => ref.resolved && ref.resolved.name === name)) {
        return true;
    }

    const variable = astUtils.getVariableByName(initScope, name);

    if (variable !== null) {
        return variable.defs.some(def => def.type === "Parameter");
    }

    return false;
}
function isOuterVariableInDestructing(name, initScope) {

    if (initScope.through.find(ref => ref.resolved && ref.resolved.name === name)) {
        return true;
    }

    const variable = astUtils.getVariableByName(initScope, name);

    if (variable !== null) {
        return variable.defs.some(def => def.type === "Parameter");
    }

    return false;
}
function isOuterVariableInDestructing ( name , initScope ) { if ( initScope . through . find ( ref => ref . resolved && ref . resolved . name === name ) ) { return true ; } const variable = astUtils . getVariableByName ( initScope , name ) ; if ( variable !== null ) { return variable . defs . some ( def => def . type === "Parameter" ) ; } return false ; }
Checks if an property or element is from outer scope or function parameters
in destructing pattern.

@param {string} name - A variable name to be checked.
@param {eslint-scope.Scope} initScope - A scope to start find.
@returns {boolean} Indicates if the variable is from outer scope or function parameters.
Checks if an property or element is from outer scope or function parameters in destructing pattern .