1

I'm coding a JavaScript app using ECMAScript 2015.

See the screenshot bellow:

enter image description here

Visual Studio 2015 cries showing the following warning:

Expected ';'

It happens when I export the whole App class. If I drop the export keyword Visual Studio won't show warnings.

Is this a known bug or there's some way to get rid of the warning? Since there's this warning, code formatting, indentation and other features aren't working since it's like a syntax error.

Matías Fidemraizer
  • 63,804
  • 18
  • 124
  • 206
  • Your code is ES6 valid, probably VS doesn't implement it correctly, WebStorm has a great es6 support – Hitmands Dec 22 '15 at 09:45
  • [Related issue](http://stackoverflow.com/questions/31544470/es6-es7-support-in-visual-studio-2015-community) – CodingIntrigue Dec 22 '15 at 10:00
  • @RGraham I see, BTW they claim that VS2015 already supports ECMA2015... – Matías Fidemraizer Dec 22 '15 at 10:18
  • @MatíasFidemraizer *Most* of ES2015, not all. Read [this post](http://blogs.msdn.com/b/visualstudio/archive/2015/06/10/javascript-editor-improvements-in-visual-studio-2015.aspx) which details exactly which parts are supported and which aren't. Lack of `module` support is probably what's causing your issue above. – CodingIntrigue Dec 22 '15 at 10:21
  • @RGraham In fact I've already read that article. Since it claims that classes are implemented in the new language service I can't understand why they've not already implemented exports on classes (they support constants, variables...) – Matías Fidemraizer Dec 22 '15 at 10:28
  • 1
    @MatíasFidemraizer True, it's strange. You can work around the issue by defining your `exports` at the end of your file, [like this](https://babeljs.io/repl/#?experimental=false&evaluate=true&loose=false&spec=false&code=class%20MyClass%20%7B%0D%20%20%20%20run()%20%7B%0D%20%20%20%20%20%20%20%20%0D%20%20%20%20%7D%0D%7D%0Dexport%20%7BMyClass%7D%3B). Again strange, but at least it works – CodingIntrigue Dec 22 '15 at 10:37

0 Answers0