lib/rules/comma-dangle.js
function forbidTrailingComma(node) {
            const lastItem = getLastItem(node);

            if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) {
                return;
            }

            const trailingToken = getTrailingToken(node, lastItem);

            if (astUtils.isCommaToken(trailingToken)) {
                context.report({
                    node: lastItem,
                    loc: trailingToken.loc.start,
                    messageId: "unexpected",
                    fix(fixer) {
                        return fixer.remove(trailingToken);
                    }
                });
            }
        }
function forbidTrailingComma(node) {
            const lastItem = getLastItem(node);

            if (!lastItem || (node.type === "ImportDeclaration" && lastItem.type !== "ImportSpecifier")) {
                return;
            }

            const trailingToken = getTrailingToken(node, lastItem);

            if (astUtils.isCommaToken(trailingToken)) {
                context.report({
                    node: lastItem,
                    loc: trailingToken.loc.start,
                    messageId: "unexpected",
                    fix(fixer) {
                        return fixer.remove(trailingToken);
                    }
                });
            }
        }
function forbidTrailingComma ( node ) { const lastItem = getLastItem ( node ) ; if ( ! lastItem || ( node . type === "ImportDeclaration" && lastItem . type !== "ImportSpecifier" ) ) { return ; } const trailingToken = getTrailingToken ( node , lastItem ) ; if ( astUtils . isCommaToken ( trailingToken ) ) { context . report ( { node : lastItem , loc : trailingToken . loc . start , messageId : "unexpected" , fix ( fixer ) { return fixer . remove ( trailingToken ) ; } } ) ; } }
Reports a trailing comma if it exists.

@param {ASTNode} node - A node to check. Its type is one of
ObjectExpression, ObjectPattern, ArrayExpression, ArrayPattern,
ImportDeclaration, and ExportNamedDeclaration.
@returns {void}
Reports a trailing comma if it exists .