lib/rules/operator-assignment.js
function verify(node) {
            if (node.operator !== "=" || node.right.type !== "BinaryExpression") {
                return;
            }

            const left = node.left;
            const expr = node.right;
            const operator = expr.operator;

            if (isCommutativeOperatorWithShorthand(operator) || isNonCommutativeOperatorWithShorthand(operator)) {
                if (same(left, expr.left)) {
                    context.report({
                        node,
                        messageId: "replaced",
                        fix(fixer) {
                            if (canBeFixed(left)) {
                                const equalsToken = getOperatorToken(node);
                                const operatorToken = getOperatorToken(expr);
                                const leftText = sourceCode.getText().slice(node.range[0], equalsToken.range[0]);
                                const rightText = sourceCode.getText().slice(operatorToken.range[1], node.right.range[1]);

                                return fixer.replaceText(node, `${leftText}${expr.operator}=${rightText}`);
                            }
                            return null;
                        }
                    });
                } else if (same(left, expr.right) && isCommutativeOperatorWithShorthand(operator)) {

                    /*
                     * This case can't be fixed safely.
                     * If `a` and `b` both have custom valueOf() behavior, then fixing `a = b * a` to `a *= b` would
                     * change the execution order of the valueOf() functions.
                     */
                    context.report({
                        node,
                        messageId: "replaced"
                    });
                }
            }
        }
function verify(node) {
            if (node.operator !== "=" || node.right.type !== "BinaryExpression") {
                return;
            }

            const left = node.left;
            const expr = node.right;
            const operator = expr.operator;

            if (isCommutativeOperatorWithShorthand(operator) || isNonCommutativeOperatorWithShorthand(operator)) {
                if (same(left, expr.left)) {
                    context.report({
                        node,
                        messageId: "replaced",
                        fix(fixer) {
                            if (canBeFixed(left)) {
                                const equalsToken = getOperatorToken(node);
                                const operatorToken = getOperatorToken(expr);
                                const leftText = sourceCode.getText().slice(node.range[0], equalsToken.range[0]);
                                const rightText = sourceCode.getText().slice(operatorToken.range[1], node.right.range[1]);

                                return fixer.replaceText(node, `${leftText}${expr.operator}=${rightText}`);
                            }
                            return null;
                        }
                    });
                } else if (same(left, expr.right) && isCommutativeOperatorWithShorthand(operator)) {

                    /*
                     * This case can't be fixed safely.
                     * If `a` and `b` both have custom valueOf() behavior, then fixing `a = b * a` to `a *= b` would
                     * change the execution order of the valueOf() functions.
                     */
                    context.report({
                        node,
                        messageId: "replaced"
                    });
                }
            }
        }
function verify ( node ) { if ( node . operator !== "=" || node . right . type !== "BinaryExpression" ) { return ; } const left = node . left ; const expr = node . right ; const operator = expr . operator ; if ( isCommutativeOperatorWithShorthand ( operator ) || isNonCommutativeOperatorWithShorthand ( operator ) ) { if ( same ( left , expr . left ) ) { context . report ( { node , messageId : "replaced" , fix ( fixer ) { if ( canBeFixed ( left ) ) { const equalsToken = getOperatorToken ( node ) ; const operatorToken = getOperatorToken ( expr ) ; const leftText = sourceCode . getText ( ) . slice ( node . range [ 0 ] , equalsToken . range [ 0 ] ) ; const rightText = sourceCode . getText ( ) . slice ( operatorToken . range [ 1 ] , node . right . range [ 1 ] ) ; return fixer . replaceText ( node , ` ${ leftText } ${ expr . operator } ${ rightText } ` ) ; } return null ; } } ) ; } else if ( same ( left , expr . right ) && isCommutativeOperatorWithShorthand ( operator ) ) { /*
                     * This case can't be fixed safely.
                     * If `a` and `b` both have custom valueOf() behavior, then fixing `a = b * a` to `a *= b` would
                     * change the execution order of the valueOf() functions.
                     */ context . report ( { node , messageId : "replaced" } ) ; } } }
Ensures that an assignment uses the shorthand form where possible.
@param   {ASTNode} node An AssignmentExpression node.
@returns {void}
Ensures that an assignment uses the shorthand form where possible .