babel / babylon

PSA: moved into babel/babel as @babel/parser -->

Home Page:https://github.com/babel/babel/tree/master/packages/babel-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to parse a class get method with a decorator

mbehzad opened this issue · comments

The error is thrown when the jsdoc lib is trying to parse a class with get method which has a decorator.

Input Code

  @override
  static get COMPONENT_NAME() {
    return "Overlay";
  }

Babylon/Babel Configuration

used by the jsdoc lib

{
    allowImportExportEverywhere: true,
    allowReturnOutsideFunction: true,
    allowSuperOutsideMethod: true,
    plugins: [
        'asyncGenerators',
        'bigInt',
        'classPrivateProperties',
        'classProperties',
        'decorators2',
        'doExpressions',
        'dynamicImport',
        'estree',
        'exportExtensions',
        'functionBind',
        'functionSent',
        'importMeta',
        'jsx',
        'numericSeparator',
        'objectRestSpread',
        'optionalCatchBinding',
        'optionalChaining'
    ],
    ranges: true,
    sourceType: env.conf.sourceType
}

Expected Behavior

Should (?) parse a get method with decorator similar to a normal instance method.

Current Behavior

Parser throws ERROR: Unable to parse <file-path>: Stage 2 decorators may only be used with a class or a class method error.

Your Environment

software version
Babylon 7.0.0-beta.17
node v7.8.0
npm 3.10.8
Operating System windows 10 (64bit)
commented

Hey @mbehzad! 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.

This issue has been moved to babel/babel#6670.