lib/rules/no-unused-vars.js
function isForInRef(ref) {
            let target = ref.identifier.parent;


            // "for (var ...) { return; }"
            if (target.type === "VariableDeclarator") {
                target = target.parent.parent;
            }

            if (target.type !== "ForInStatement") {
                return false;
            }

            // "for (...) { return; }"
            if (target.body.type === "BlockStatement") {
                target = target.body.body[0];

            // "for (...) return;"
            } else {
                target = target.body;
            }

            // For empty loop body
            if (!target) {
                return false;
            }

            return target.type === "ReturnStatement";
        }
function isForInRef(ref) {
            let target = ref.identifier.parent;


            // "for (var ...) { return; }"
            if (target.type === "VariableDeclarator") {
                target = target.parent.parent;
            }

            if (target.type !== "ForInStatement") {
                return false;
            }

            // "for (...) { return; }"
            if (target.body.type === "BlockStatement") {
                target = target.body.body[0];

            // "for (...) return;"
            } else {
                target = target.body;
            }

            // For empty loop body
            if (!target) {
                return false;
            }

            return target.type === "ReturnStatement";
        }
function isForInRef ( ref ) { let target = ref . identifier . parent ; // "for (var ...) { return; }" if ( target . type === "VariableDeclarator" ) { target = target . parent . parent ; } if ( target . type !== "ForInStatement" ) { return false ; } // "for (...) { return; }" if ( target . body . type === "BlockStatement" ) { target = target . body . body [ 0 ] ; // "for (...) return;" } else { target = target . body ; } // For empty loop body if ( ! target ) { return false ; } return target . type === "ReturnStatement" ; }
Determine if an identifier is used either in for-in loops.

@param {Reference} ref - The reference to check.
@returns {boolean} whether reference is used in the for-in loops
@private
Determine if an identifier is used either in for - in loops .