Search code examples
visual-studio-2015ecmascript-6aureliaecmascript-2016

ES6 / ES7 support in Visual Studio 2015 Community


I'm hearing that VS 2015 is supporting the new js syntax but when I open up a project written using aurelia.js in this IDE intellisense complains about many, many things eg.

export class UpperValueConverter {
  toView(value){
    return value && value.toUpperCase();
  }
}

I have the WebEssentials 2015 installed. Still nothing seems to work... Probably an important information is that my current VS installation is a fresh one, so I didn't mess up any settings.


Solution

  • I was having this problem in .jsx files, visual studio 2015 was using the react-tools plugin to parse and highlight the syntax errors.

    I can't find the question i got this from now, but someone said to change a line in the following file:

    C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\react-server\server.js
    

    Change the following line:

    var transformed = reactTools.transformWithDetails(code, { elementMap: true });
    

    To:

    var transformed = reactTools.transformWithDetails(code, 
        { elementMap: true, 
          es6module: "--es6module", 
          harmony: "--harmony", 
          nonStrictEs6module: "--non-strict-es6module"  });
    

    I added the option nonStrictEs6module, and now it doesn't warn me over most things except directly assigned arrows functions:

    enter image description here

    It would be nice if we could somehow I managed to swap out the react-tools transform for a babel stage-1 transformer, check out my answer here :-)