Decorators and VSCode

I created a new Ember 3.11 app with Ember CLI 3.11. I’m trying out ES6 classes and decorators for the first time since I saw the example in the 3.11 release post. However, VSCode (which I’m also new to) doesn’t like the decorator syntax. After searching, it seemed like creating a jsconfig.json file with the following should fix it, but it didn’t.

{
  "compilerOptions": {
    "experimentalDecorators": true
  }
}

Anyone have a jsconfig.json file that works?

1 Like

I think it’s a bug that this isn’t already setup correctly in the blueprint.

Install the babel-eslint package and put this line into .eslintrc.js:

parser: 'babel-eslint',

I found an open issue.

1 Like

I suppose since the official docs still don’t show decorators, this isn’t really a bug so much as a not-yet-implemented part of the new Octane experience.

(The features in Ember itself that make decorators work are done and stable and people can totally use them, but it’s not really done done until all the docs reflect the new way and the rough edges like this one are polished away. See also Ember.js Guides - Guides and Tutorials - Ember Guides)

Thanks so much @ef4!