PhpStorm 2020.2 - XML tags are not supported by current JavaScript version

Answered

Hello,

 

I have this error in phpstorm 2020.2 in laravel blade file. 

Why is acting like this the inspection ? (see the photo)

Could be because of the node_modules ?

 

 

ds

0
1 comment

Hi there,

It's a new feature in 2020.2 -- it injects JavaScript into Blade's section with "javascript" name. The same is done for CSS in "css" section. These are common section names used for such purposes in many projects. This kind of stuff already exists for Smarty/Twig, now it's present for Blade as well.

Basically: the code between @section('javascript') and @stop/@endsection is treated as JavaScript (and not HTML that you have got there).

 

Solution: Just use "scripts" or anything else instead of "javascript" (for "css" I suggest "styles" name).

 

P.S. In case if you do not plan to ever use such blocks in such way (pure JavaScript inside "javascript" instead of <script> tags) then you may also just disable those rules in "Settings/Preferences | Editor | Language Injections" -- they will be at the top.

1

Please sign in to leave a comment.