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

14 comments

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"

0

Hello,

Do you have react.js in your project? What version is it? Did you include it as a "<script src="?

0

Hi,

1. Yes, it is already set to HTML5.
2. Inside a react.twig file I have:

<script src="https://fb.me/react-15.0.1.js"></script>
<script src="js/react/general_components/react-dom.min.js"></script>
<script src="js/react/general_components/browser.min.js"></script>

 

 

0

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/

0

The data- attributes are from HTML5 and has nothing to do with react.
Why do they generate warnings?

 

0

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 ?

0

Thanks, please try EAP build I've linked: this piece of code is looking good there.

0

Hi,

Yes, this looks better!

(So, for me it is better to wait ???)

0

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

 

0

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 

0

Please sign in to leave a comment.