JSX cannot be parsed

I have a web-project with severl React JS files in it. Those files cannot be read / parsed / whatever by Phpstorm.

Project JS version is set to be JSX, but it seems the files are not read as JSX.

React lib installed.

Creating a new project did not help either.

 

Any help please?

0
6 comments

> Those files cannot be read / parsed / whatever by Phpstorm.

 

Could you please elaborate or attach a screenshot?

0

Please note all the red highlights and totally wrong parsing of JSX (at the bottom). The code is fine, compiles and works.

0

Could you please read the warning message on a red highlight?

Also, I am wondering -- what icon type do you see for this file in editor tab title and what does the "Editor | File Types > React JSX" contain for the registered pattern? 

0

The errors differ, looks like the editor cannot understand the language, i.e

or

 

The icons I see for the files are JS icons; as for the pattern, it's JSX

however, the files actually are .js. Do you think renaming them will fix the issue?

0

same as https://intellij-support.jetbrains.com/hc/en-us/community/posts/360002840580/comments/360001006759

>Do you think renaming them will fix the issue?

 

yes, renaming files to .jsx will likely fix the issue, as they won't depend on chosen language version then and will always be treated as JSX files

0

renamed the files, it indeed fixes most of the issues.

thanks!

0

Please sign in to leave a comment.