lib/rules/spaced-comment.js
function reportBegin(node, message, match, refChar) {
            const type = node.type.toLowerCase(),
                commentIdentifier = type === "block" ? "/*" : "//";

            context.report({
                node,
                fix(fixer) {
                    const start = node.range[0];
                    let end = start + 2;

                    if (requireSpace) {
                        if (match) {
                            end += match[0].length;
                        }
                        return fixer.insertTextAfterRange([start, end], " ");
                    }
                    end += match[0].length;
                    return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : ""));

                },
                message,
                data: { refChar }
            });
        }
function reportBegin(node, message, match, refChar) {
            const type = node.type.toLowerCase(),
                commentIdentifier = type === "block" ? "/*" : "//";

            context.report({
                node,
                fix(fixer) {
                    const start = node.range[0];
                    let end = start + 2;

                    if (requireSpace) {
                        if (match) {
                            end += match[0].length;
                        }
                        return fixer.insertTextAfterRange([start, end], " ");
                    }
                    end += match[0].length;
                    return fixer.replaceTextRange([start, end], commentIdentifier + (match[1] ? match[1] : ""));

                },
                message,
                data: { refChar }
            });
        }
function reportBegin ( node , message , match , refChar ) { const type = node . type . toLowerCase ( ) , commentIdentifier = type === "block" ? "/*" : "//" ; context . report ( { node , fix ( fixer ) { const start = node . range [ 0 ] ; let end = start + 2 ; if ( requireSpace ) { if ( match ) { end += match [ 0 ] . length ; } return fixer . insertTextAfterRange ( [ start , end ] , " " ) ; } end += match [ 0 ] . length ; return fixer . replaceTextRange ( [ start , end ] , commentIdentifier + ( match [ 1 ] ? match [ 1 ] : "" ) ) ; } , message , data : { refChar } } ) ; }
Reports a beginning spacing error with an appropriate message.
@param {ASTNode} node - A comment node to check.
@param {string} message - An error message to report.
@param {Array} match - An array of match results for markers.
@param {string} refChar - Character used for reference in the error message.
@returns {void}
Reports a beginning spacing error with an appropriate message .