Attribute is not allowed here
Hi,
I'm totally new to PHP storm (evaluating the software) and I have a lot off warnings in my .js files:
<button className="btn btn-success btn-sm" data-toggle="modal" data-target="#modal_inspection_check"
onClick={this.handleClick_check}>Car inspected</button>
The editor is not accepting the data- attributes??
It is already in JSX harmony, I have added React templates as plugin and added react as DefinitelyTyped as Javascript libraries.
What must I do to avoid those warnings?
Korstiaan
请先登录再写评论。
Hi there,
Not 100% sure on this .. but please check what Default HTML Language Level do you have for your project -- "Settings/Preferences | Languages & Frameworks | Schemas and DTDs | Default XML Schemas"
Try setting it to "HTML 5"
Hello,
Do you have react.js in your project? What version is it? Did you include it as a "<script src="?
Hi,
1. Yes, it is already set to HTML5.
2. Inside a react.twig file I have:
Referencing React via CDN link is not enough, you need including react.js in your project (set up as a javascript library, or put the file into the project directory). See https://blog.jetbrains.com/webstorm/2015/10/working-with-reactjs-in-webstorm-coding-assistance/
The data- attributes are from HTML5 and has nothing to do with react.
Why do they generate warnings?
What PhpStorm version are you running? Could you please try the same in EAP build: https://confluence.jetbrains.com/display/PhpStorm/PhpStorm+Early+Access+Program ?
2016.2
Build #PS - 162.1121.38
Thanks, please try EAP build I've linked: this piece of code is looking good there.
Hi,
Yes, this looks better!
(So, for me it is better to wait ???)
please follow https://youtrack.jetbrains.com/issue/WEB-22667 for updates
Hi,
I'm sorry but I opened the project today and all the warnings concerning the data- attributes are back!
I' using the EAP version.
So the EAP version does NOT help?
(Maybe I didn't wait long enough before?)
Korstiaan
It does not. Please follow https://youtrack.jetbrains.com/issue/WEB-22667 for updates
I just react on the comment of Dmitri Tronin who says that I should try the EAP build.
It is just to say that it does not work with this EAP.
I will wait for the updates...
https://youtrack.jetbrains.com/issue/WEB-22667
Thanks for the update