"ECMAscript 6" - all of a sudden arrow functions cause error "expression expected" (solved)

I had everything setup and had no warnings or errors in my code from any inspection. I use ES 2015 features like arrow functions, the code did not cause errors - I had "ECMAscript 6" enabled for the source directory.

Then the notebook crashed, stuff got lost - fortunately I had everythig in a git repository, I push *often*.

So I clone the directory - which includes the .idea directory minus workspace.xml - and EVEN THOUG THE SETTINGS LOOK THE SAME (incl. "ECMAscript 6" is set) now WebStorm (10.0.4) complains about arrow function syntax, red error "expression expected"!

What happened? How can I get rid of the error?

As I said, I had made NO CHANGES to the code and before I set up fresh WebStorm did not complain about that file (I had it open so I am certain the inspections ran previously too).

It also complains about "let" instead of "var" -- the "ECMAscript 6" setting is ignored!!


So I found that I have to also set the Javascript version in Settings -> Languages and Frameworks -> Javascript. This seems superfluous since I have the detailed library dialog where I say per-directory which libs/JS/node.js version I want.

I'll file a bug: It is clearly a bug that this setting is not stored in this case!

EDIT: bug report is at https://youtrack.jetbrains.com/issue/WEB-17262

Comment actions Permalink

Thanks for the solution.  I have never had that problem before but it is still happening!

Comment actions Permalink

I might found a solution, the below worked for me.

Webstorm > Preferences > Languages and Frameworks -> Javascript > ECMA Script6

IMPORTANT NOTE: do NOT go to Languages and Frameworks from File > Default Settings


Comment actions Permalink

Indeed, modifying default settings only affects new projects, use Preferences | Languages and Frameworks | Javascript to change language level for your current project

Comment actions Permalink

I'm having issues getting the default version to work in scratch files. Seems it doesn't apply there?

Comment actions Permalink

I tried all solutions on internet to solve this problem and all doesn't  work for me. 

ONE THING WORKED FOR ME FOR THAT PROBLEMS : I update node.js in my computer and now all its fine ;)

Simply install this from https://nodejs.org/en/download/ to your ProgramFiles(x86)/nodejs . 

Cheers ;)


Please sign in to leave a comment.