-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser
Description
Choose one: is this a bug report or feature request? Bug
Had the following package json script: "build": "rimraf dist && babel ./src -d dist --ignore tests"
After installing babel-cli version "^6.24.1" as dependency, a comment is removed from object with trailing comma. Before the script was relying on global babel installation
$ babel --version
6.7.7 (babel-core 6.7.7)
Input Code
input
const foo = {
// Coment 1
'prop-1': {
inner1: "bar",// Comment 2
inner2: 'never',
inner3: [], // Comment 3: Last in object prop. Appears after removing trailing comma in "inner3"
},
// Comment 4
'prop-2': 0,
};
const bar = {
// Coment 1
'prop-1': {
inner1: "bar",// Comment 2
inner2: 'never',
inner3: [] // Comment 3: Last in object prop. Appears after removing trailing comma in "inner3"
},
// Comment 4
'prop-2': 0,
};output
'use strict';
var foo = {
// Coment 1
'prop-1': {
inner1: "bar", // Comment 2
inner2: 'never',
inner3: [] },
// Comment 4
'prop-2': 0
};
var bar = {
// Coment 1
'prop-1': {
inner1: "bar", // Comment 2
inner2: 'never',
inner3: [] // Comment 3: Last in object prop. Appears after removing trailing comma in "inner3"
},
// Comment 4
'prop-2': 0
};Babel Configuration (.babelrc, package.json, cli command)
See REPL link.
Expected Behavior
Expect the "comment 3" to not be removed.
Current Behavior
The "comment 3" is removed when using trailing comma.
Your Environment
See REPL link.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
outdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: parser