lib/rules/comma-dangle.js
function getTrailingToken(node, lastItem) {
            switch (node.type) {
                case "ObjectExpression":
                case "ArrayExpression":
                case "CallExpression":
                case "NewExpression":
                    return sourceCode.getLastToken(node, 1);
                default: {
                    const nextToken = sourceCode.getTokenAfter(lastItem);

                    if (astUtils.isCommaToken(nextToken)) {
                        return nextToken;
                    }
                    return sourceCode.getLastToken(lastItem);
                }
            }
        }
function getTrailingToken(node, lastItem) {
            switch (node.type) {
                case "ObjectExpression":
                case "ArrayExpression":
                case "CallExpression":
                case "NewExpression":
                    return sourceCode.getLastToken(node, 1);
                default: {
                    const nextToken = sourceCode.getTokenAfter(lastItem);

                    if (astUtils.isCommaToken(nextToken)) {
                        return nextToken;
                    }
                    return sourceCode.getLastToken(lastItem);
                }
            }
        }
function getTrailingToken ( node , lastItem ) { switch ( node . type ) { case "ObjectExpression" : case "ArrayExpression" : case "CallExpression" : case "NewExpression" : return sourceCode . getLastToken ( node , 1 ) ; default : { const nextToken = sourceCode . getTokenAfter ( lastItem ) ; if ( astUtils . isCommaToken ( nextToken ) ) { return nextToken ; } return sourceCode . getLastToken ( lastItem ) ; } } }
Gets the trailing comma token of the given node.
If the trailing comma does not exist, this returns the token which is
the insertion point of the trailing comma token.

@param {ASTNode} node - The node to get.
@param {ASTNode} lastItem - The last item of the node.
@returns {Token} The trailing comma token or the insertion point.
Gets the trailing comma token of the given node . If the trailing comma does not exist this returns the token which is the insertion point of the trailing comma token .