WebStorm “Let definition are not supported by current JavaScript version”
JavascriptWebstormJavascript Problem Overview
I am trying to use new tools available for coding in JavaScript. I've seen the post https://stackoverflow.com/questions/35772101/phpstorm-let-definition-are-not-supported-by-current-javascript-version. I've tried as suggested over there, but do not work.
When I hover over the export
> Export declarations are not supported by current JavaScript version
When I hover over the yield
> Generators are not supported by current JavaScript version
and hovering over the let
> Let definition are not supported by current JavaScript version
So the question is how to upgrade the JavaScript version?
Javascript Solutions
Solution 1 - Javascript
It can be set up like in the following image:
Flow: File -> Settings -> Languages & Frameworks -> Javascript
Solution 2 - Javascript
Make sure you restart your IDE after changing the JS language version to ECMAScript 6.
Solution 3 - Javascript
You need to set your JavaScript version in the IDE. This can be accessed on Windows with ctrl + alt + s. You need at least ECMA Script 6 to use let
.
Solution 4 - Javascript
As others suggested, setting the language version does fix this:
File -> Settings -> Languages & Frameworks -> Javascript
However, that was not enough in my case. If you're experiencing these errors in a project that is nested within another project you must apply the JS language settings to the parent project as well.
In my case, it was a client-side React app nested inside a larger Java-based web-portal (Working with IntelliJ IDEA Ultimate, which uses the same settings flow). I am adding this answer to the discussion in the hope that it can help someone in the future.
Solution 5 - Javascript
You have to change the settings for using this keyword
Go to File -> Settings -> Languages & Frameworks -> Javascript (Select ECMA Script 6)