lib/rules/space-unary-ops.js
function verifyNonWordsHaveSpaces(node, firstToken, secondToken) {
            if (node.prefix) {
                if (isFirstBangInBangBangExpression(node)) {
                    return;
                }
                if (firstToken.range[1] === secondToken.range[0]) {
                    context.report({
                        node,
                        messageId: "operator",
                        data: {
                            operator: firstToken.value
                        },
                        fix(fixer) {
                            return fixer.insertTextAfter(firstToken, " ");
                        }
                    });
                }
            } else {
                if (firstToken.range[1] === secondToken.range[0]) {
                    context.report({
                        node,
                        messageId: "beforeUnaryExpressions",
                        data: {
                            token: secondToken.value
                        },
                        fix(fixer) {
                            return fixer.insertTextBefore(secondToken, " ");
                        }
                    });
                }
            }
        }
function verifyNonWordsHaveSpaces(node, firstToken, secondToken) {
            if (node.prefix) {
                if (isFirstBangInBangBangExpression(node)) {
                    return;
                }
                if (firstToken.range[1] === secondToken.range[0]) {
                    context.report({
                        node,
                        messageId: "operator",
                        data: {
                            operator: firstToken.value
                        },
                        fix(fixer) {
                            return fixer.insertTextAfter(firstToken, " ");
                        }
                    });
                }
            } else {
                if (firstToken.range[1] === secondToken.range[0]) {
                    context.report({
                        node,
                        messageId: "beforeUnaryExpressions",
                        data: {
                            token: secondToken.value
                        },
                        fix(fixer) {
                            return fixer.insertTextBefore(secondToken, " ");
                        }
                    });
                }
            }
        }
function verifyNonWordsHaveSpaces ( node , firstToken , secondToken ) { if ( node . prefix ) { if ( isFirstBangInBangBangExpression ( node ) ) { return ; } if ( firstToken . range [ 1 ] === secondToken . range [ 0 ] ) { context . report ( { node , messageId : "operator" , data : { operator : firstToken . value } , fix ( fixer ) { return fixer . insertTextAfter ( firstToken , " " ) ; } } ) ; } } else { if ( firstToken . range [ 1 ] === secondToken . range [ 0 ] ) { context . report ( { node , messageId : "beforeUnaryExpressions" , data : { token : secondToken . value } , fix ( fixer ) { return fixer . insertTextBefore ( secondToken , " " ) ; } } ) ; } } }
Verifies UnaryExpression, UpdateExpression and NewExpression have spaces before or after the operator
@param {ASTnode} node AST node
@param {Object} firstToken First token in the expression
@param {Object} secondToken Second token in the expression
@returns {void}
Verifies UnaryExpression UpdateExpression and NewExpression have spaces before or after the operator