ES6 functions reported as error in WebStorm 关注
I'm working on a Meteor project that includes ES6, and it's not recognizing properly and reporting as error.
As an example:
this.autorun( () => this.subscribe('products',
The first line is reporting 2 errors - both the () and the arrow function. But it works perfectly in program.
Very annoying that if I use ES6 the entire directory branch turns red, makes it really hard to find out if there really is an error.
Any advice on how I could fix this?
works fine for me:
Please try invalidating caches - does the problem persist? If yes, please attach screenshots of your settings plus the screenshot of the file with errors. Does the problem occur in .js files? Or?
I'm also having issues with formatting .vue files.
This code is valid and works fine, although Webstorm is reporting errors
When beautifying this code it gets even worse, effectively introducing real errors.
Before going into further detail, does anyone know of any issues around es6 formatting ?
seems to be fixed with latest update
Build #WS-163.7743.51, built on November 22, 2016
hm... not fixed.
Problem randomply occurs
Please try invalidating caches (File | Invalidate caches, restart)
Invalidating caches only fixes the problem temporarily. Need to do this almost every day.
No one else having this problem?
there must be some errors that lead to index corruption. Please recreate the issue and attach your idea.log
I might found a solution, the below worked for me.
IMPORTANT NOTE: do NOT go to Languages and Frameworks from File > Default Settings
Same goes for PHPStorm, but what I realized is the errors were being generated from JSHint. It looks like PHPStorm/WebStorm do not sync the version to JSHint.
The fix for me:
Under Code Quality Tools > JSHint, make sure "EcmaScript.next esnext" is checked.
I've been having this issue for the last year or so, the only solution is invalidating caches, sometimes that fix lasts for a few weeks, other times it only lasts a few hours. I've tried all of the solutions mentioned above in this thread.
> the only solution is invalidating caches, sometimes that fix lasts for a few weeks, other times it only lasts a few hours.
I can think of 2 possible reasons for this behavior:
- your indexes get broken because of some errors
In the latter case, please try the following:
- invalidate caches, delete all idea.log.* files
- wait until the problem appears again
- provide all generated idea.log.* files
JSHint was flagging (underlining) ES6 constructs until I had all of these tweaks in place:
Trash the cache
Set JSHint warning to ECMAScript 6
I wanna share some experience if someone like me got here for answer and didn't find it.
I was hoping to get an answer from logs and found that Help | Show log in explorer contains rather much data, so I decided to first delete everything from that directory. After that, I restarted WebStorm and... errors are gone.
I have absolutely no idea, what happened and how is that ever possible, but if solutions provided here don't work for you, try doing the same.
Just for the ones that make the mistake I did.
I imported a function named init while having a init field in the window global object
(Banged my head against the wall for an hour. Maybe this saves someone's else time :))