Skip to content

Comment after the last item in an array literal is dropped if there's a trailing comma #10368

@banga

Description

@banga

Bug Report

Current Behavior

Input Code
REPL link here

const foo = [
    "one", // One
    "two", // Two
];

const bar = [
    "one", // One
    "two" // Two
];

transpiles to

"use strict";

var foo = ["one", // One
"two"];
var bar = ["one", // One
"two" // Two
];

Expected behavior/code

"use strict";

var foo = ["one", // One
"two" // Two
];
var bar = ["one", // One
"two" // Two
];

Babel Configuration (.babelrc, package.json, cli command)
See REPL link

Environment
See REPL link

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedA closed issue/PR that is archived due to age. Recommended to make a new issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions