rubenv / angular-gettext-tools

Tools for extracting/compiling angular-gettext strings.
http://angular-gettext.rocketeer.be/
MIT License
39 stars 130 forks source link

ES6 Parsing seems to be Broken with 2.2.1 #144

Open sbrandtb opened 8 years ago

sbrandtb commented 8 years ago

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 commented 8 years ago

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?

kwypchlo commented 8 years ago

+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?

IShotTheSheriff commented 8 years ago

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.

NicoPennec commented 8 years ago

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