WebStorm/PhpStorm warning for react attributes in jsx like className

回眸只為那壹抹淺笑 提交于 2019-12-21 07:25:21

问题


I can not remove following warning in react code. "Attribute className is not allowed here".

  • Warning in PhpStorm

  • Unknown HTML tag attribute can not be set to camelcase only lower case is saved, and turning the check off is not helping.

  • Settings in Languages & Frameworks > JavaScript > Libraries

Can you help me I have warnings for every attribute in jsx. Editor is set jsx harmony.


回答1:


My problem with warnings in jsx was solved by instaling React-Template plugin.




回答2:


I'm a little late on the scene but performing Invalidate Caches/Restart... solved the issue (after switching to JSX Harmony).




回答3:


You should add Reactjs library.

Using Reactjs in JavaScript and TypeScript

In my case, I've just added Reactjs support for TypeScript:




回答4:


Had a similar problem like the asker - after updating to IntelliJ 2016.3, the values of the classNames were marked as errors (not the "className" attribute itself, but it's similar to what he had).

My solution was to select "Uninject language or reference" from the little lightbulb that appears when you put your cursor on the error:

Have no idea why it works.

Couldn't find any decent React/JSX plugins for Intellij either, except from the above mentioned "React-Templates" which did wonders in the past.

But it seems Intellij's native (I guess) support for JSX & React is not bad, except for annoying things like this.



来源:https://stackoverflow.com/questions/36126292/webstorm-phpstorm-warning-for-react-attributes-in-jsx-like-classname

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!