lib/rules/comma-spacing.js
function validateCommaItemSpacing(tokens, reportItem) {
            if (tokens.left && astUtils.isTokenOnSameLine(tokens.left, tokens.comma) &&
                    (options.before !== sourceCode.isSpaceBetweenTokens(tokens.left, tokens.comma))
            ) {
                report(reportItem, "before", tokens.left);
            }

            if (tokens.right && astUtils.isClosingParenToken(tokens.right)) {
                return;
            }

            if (tokens.right && !options.after && tokens.right.type === "Line") {
                return;
            }

            if (tokens.right && astUtils.isTokenOnSameLine(tokens.comma, tokens.right) &&
                    (options.after !== sourceCode.isSpaceBetweenTokens(tokens.comma, tokens.right))
            ) {
                report(reportItem, "after", tokens.right);
            }
        }
function validateCommaItemSpacing(tokens, reportItem) {
            if (tokens.left && astUtils.isTokenOnSameLine(tokens.left, tokens.comma) &&
                    (options.before !== sourceCode.isSpaceBetweenTokens(tokens.left, tokens.comma))
            ) {
                report(reportItem, "before", tokens.left);
            }

            if (tokens.right && astUtils.isClosingParenToken(tokens.right)) {
                return;
            }

            if (tokens.right && !options.after && tokens.right.type === "Line") {
                return;
            }

            if (tokens.right && astUtils.isTokenOnSameLine(tokens.comma, tokens.right) &&
                    (options.after !== sourceCode.isSpaceBetweenTokens(tokens.comma, tokens.right))
            ) {
                report(reportItem, "after", tokens.right);
            }
        }
function validateCommaItemSpacing ( tokens , reportItem ) { if ( tokens . left && astUtils . isTokenOnSameLine ( tokens . left , tokens . comma ) && ( options . before !== sourceCode . isSpaceBetweenTokens ( tokens . left , tokens . comma ) ) ) { report ( reportItem , "before" , tokens . left ) ; } if ( tokens . right && astUtils . isClosingParenToken ( tokens . right ) ) { return ; } if ( tokens . right && ! options . after && tokens . right . type === "Line" ) { return ; } if ( tokens . right && astUtils . isTokenOnSameLine ( tokens . comma , tokens . right ) && ( options . after !== sourceCode . isSpaceBetweenTokens ( tokens . comma , tokens . right ) ) ) { report ( reportItem , "after" , tokens . right ) ; } }
Validates the spacing around a comma token.
@param {Object} tokens - The tokens to be validated.
@param {Token} tokens.comma The token representing the comma.
@param {Token} [tokens.left] The last token before the comma.
@param {Token} [tokens.right] The first token after the comma.
@param {Token|ASTNode} reportItem The item to use when reporting an error.
@returns {void}
@private
Validates the spacing around a comma token .