babel/babylon

.parseExpression() doesn't return a .comments property

josephfrazier opened this issue · 1 comments

Input Code

JSON.stringify(require('babylon').parseExpression(` {/*comment*/"K":"V"} `).comments, null, 2)

Babylon/Babel Configuration

// no configuration

Expected Behavior

[
  {
    "type": "CommentBlock",
    "value": "comment",
    "start": 2,
    "end": 13,
    "loc": {
      "start": {
        "line": 1,
        "column": 2
      },
      "end": {
        "line": 1,
        "column": 13
      }
    }
  }
]

Current Behavior

undefined

Your Environment

software version
Babylon master (commit f2b8d1f)
node v8.1.4
npm 5.2.0
Operating System Linux 4.10.0-26-generic #30-Ubuntu SMP Tue Jun 27 09:30:12 UTC 2017 GNU/Linux

Additional Details

Compare this with the following, which does have a comments property:

babylon.parse(`({/*comment*/"K":"V"})`)

Demo here: https://runkit.com/embed/4gm0c0f3aldo

This is blocking prettier/prettier#2476

hzoo commented

Hey @josephfrazier! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.