dimanche 23 septembre 2018

Unexpected token when using ES6 classes in Ember

I am trying to experiment with ember decorators, but can't even get to compile with fields on classes. Classes without fields are fine, but I get this error whenever there is a field:

Build Error (broccoli-persistent-filter:Babel > [Babel: l3utils])
l3utils/utils/misc-utils.js: Unexpected token (70:9)

  68 | 
  69 | class TestField extends EmberObject{
> 70 |   isField=true;
     |          ^
  71 |   qKey=null;
  72 |   _value=null;

If I just comment that out, then I get the same error on the @computed so it just doesn't seem like babel? eslint? is configured to parse the syntax at all. There's a lot of cruft in this project, but I would really like to get it going.

Does anyone have any idea as to where to look for versions or configs that may be wrong? I'm using Ember 3.3. Here are some maybe relevant versions from the package.json:

"devDependencies": {
    "@ember-decorators/babel-transforms": "^2.1.1",
    "babel-eslint": "^8.2.6",
    "broccoli-asset-rev": "^2.7.0",
    "ember-ajax": "^3.0.0",
    "ember-cli": "~3.3.0",
    "ember-cli-babel": "^6.17.2",
    "ember-cli-dependency-checker": "^2.0.0",
    "ember-cli-eslint": "^4.2.1",

I really don't understand what is going on int .eslint.js file. I try not to fool with these things too much in an effort to keep it as vanilla as possible, but it looks odd:

module.exports = {
 root: true,
 parser: 'babel-eslint',
 parserOptions: {
  ecmaVersion: 6,
  sourceType: 'module'
 },
 plugins: [
 'ember'
 ],
 extends: [
  'eslint:recommended',
  'plugin:ember/recommended'
 ],
 env: {
  browser: true
 },
 rules: {
 }, ... and so on

I've tried changing that ecmaVersion to different settings and it doesn't seem to do anything - even if I change it to a nonsensical value. I kind of don't even know where to look since it doesn't produce any configuration errors - just that syntax error.




Aucun commentaire:

Enregistrer un commentaire