Code Inspection reporting unexpected errors in new project
I'm not sure whether this is an issue with WebStorm (2017.3.4 on Windows 10 64bit), my settings, or the way I have created this project.
I have a WebStorm React project in which code inspection works as I expect it to.
I cloned the project's repository to a different location on my file system and created a new WebStorm project from that directory. The code in the initial WebStorm project is exactly the same as the code in the newly-created project.
Although the code is the same in both projects, Code Inspection is reporting numerous errors in the newly-created project that it is not reporting in the initial project.
I replaced the .idea folder in the new project with the one in the old project, and this seemed to fix the problem for a while, but I took a break, my PC went to sleep, and when I turned it back on, I was back to seeing a wall of (incorrectly reported) errors.
The errors reported are things like:
- Import declarations are not supported by the current JavaScript version.
- Destructuring assignments are not supported by the current JavaScript version.
- Shorthand property names are not supported by the current JavaScript version.
In the project's settings, I have chosen "React JSX (JSX in ECMAScript 6) as my JavaScript language version.
At the moment, this issue is making it very hard for me to continue working, as probably 70% of my code is erroneously marked as errors.
Please sign in to leave a comment.
Did you try invalidating caches (File | Invalidate caches, Invalidate and restart)? Also, is it the only project you have opened, or you have other projects opened at the same time?
I just tried it, and it seems to have taken care of the issues for now. Maybe this suggestion could be pinned to the top of this forum or included as an aside in documentation people are likely to view when trying to fix this sort of problem? It's a very annoying problem that cost me several hours today, and none of my searches led me to the suggestion you gave.
I had multiple projects open when this error occurred.
Thanks for the help...
Also, although I had chosen React JSX as my JavaScript language version, WebStorm kept asking me whether I wanted to switch my language version to React JSX. Clicking on the 'Switch' link didn't seem to have any effect, either.
Perhaps the Idea team could build some logic into the IDE that can detect this discrepancy and automatically suggest that a user may want to invalidate cache?
>I had multiple projects open when this error occurred.
the issue might be related to having several projects opened: if certain folder is shared among several projects, and language levels set for the projects are different, the level from last one is used for syntax highlighting - see https://youtrack.jetbrains.com/issue/WEB-16665
So, if you have certain files shared between projects, and language levels chosen for these projects are different, make sure to not open them at the same time