angular-gettext-tools icon indicating copy to clipboard operation
angular-gettext-tools copied to clipboard

ES6 Parsing seems to be Broken with 2.2.1

Open sbrandtb opened this issue 8 years ago • 4 comments

When using version 2.2.1, parsing ES6 files seem to be broken:

Error parsing factories/<some-file>.js at line 44 column 61, where the file contains ::this.unserializeEvent);

When downgrading to 2.2.0, this does not happen.

sbrandtb avatar May 27 '16 07:05 sbrandtb

Ok, after looking into the commits, I admit that it's just the warning that's missing. Still, can someone explain why it's not parsing?

sbrandtb avatar May 27 '16 07:05 sbrandtb

+1

Maybe this commit has something to do with it... https://github.com/rubenv/angular-gettext-tools/commit/f5f2dd3f562c2b8aeffe928f94f7e7dd58f3a640

@rubenv could you take a look?

kwypchlo avatar Jun 01 '16 13:06 kwypchlo

In my case it's broken because of imports. By default espree engine for parsing use script option. When your project uses modules it has to be set to module.

syntax = espree.parse(src, {
  attachComment: true,
  loc: true,
  ecmaVersion: 6,
  sourceType: 'module',
  ecmaFeatures: {
    jsx: true,
    experimentalObjectRestSpread: true,
    globalReturn: true
  }
}); 

I'm not sure tho if it should be changed globally or passed thru configuration options.

IShotTheSheriff avatar Jun 01 '16 14:06 IShotTheSheriff

This warning message come from the last PR : https://github.com/rubenv/angular-gettext-tools/pull/143/commits/f5ea8a0f196afd4d7d8a19ca9e51a7e48ea8c681

NicoPennec avatar Jun 02 '16 15:06 NicoPennec