lib/rules/no-unused-vars.js
function isReadForItself(ref, rhsNode) {
            const id = ref.identifier;
            const parent = id.parent;
            const granpa = parent.parent;

            return ref.isRead() && (

                // self update. e.g. `a += 1`, `a++`
                (// in RHS of an assignment for itself. e.g. `a = a + 1`
                    ((
                        parent.type === "AssignmentExpression" &&
                    granpa.type === "ExpressionStatement" &&
                    parent.left === id
                    ) ||
                (
                    parent.type === "UpdateExpression" &&
                    granpa.type === "ExpressionStatement"
                ) || rhsNode &&
                isInside(id, rhsNode) &&
                !isInsideOfStorableFunction(id, rhsNode)))
            );
        }
function isReadForItself(ref, rhsNode) {
            const id = ref.identifier;
            const parent = id.parent;
            const granpa = parent.parent;

            return ref.isRead() && (

                // self update. e.g. `a += 1`, `a++`
                (// in RHS of an assignment for itself. e.g. `a = a + 1`
                    ((
                        parent.type === "AssignmentExpression" &&
                    granpa.type === "ExpressionStatement" &&
                    parent.left === id
                    ) ||
                (
                    parent.type === "UpdateExpression" &&
                    granpa.type === "ExpressionStatement"
                ) || rhsNode &&
                isInside(id, rhsNode) &&
                !isInsideOfStorableFunction(id, rhsNode)))
            );
        }
function isReadForItself ( ref , rhsNode ) { const id = ref . identifier ; const parent = id . parent ; const granpa = parent . parent ; return ref . isRead ( ) && ( // self update. e.g. `a += 1`, `a++` ( // in RHS of an assignment for itself. e.g. `a = a + 1` ( ( parent . type === "AssignmentExpression" && granpa . type === "ExpressionStatement" && parent . left === id ) || ( parent . type === "UpdateExpression" && granpa . type === "ExpressionStatement" ) || rhsNode && isInside ( id , rhsNode ) && ! isInsideOfStorableFunction ( id , rhsNode ) ) ) ) ; }
Checks whether a given reference is a read to update itself or not.

@param {eslint-scope.Reference} ref - A reference to check.
@param {ASTNode} rhsNode - The RHS node of the previous assignment.
@returns {boolean} The reference is a read to update itself.
@private
Checks whether a given reference is a read to update itself or not .