You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.phtml file with <script type="text/x-magento-init">
magento-coding-standard v16
Steps to reproduce
Create .phtml file with <script type="text/x-magento-init">
run phpcs
Expected result
No Magento2.Legacy.PhtmlTemplate triggered
Actual result
-------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
-------------------------------------------------------------------------------------------------------------------------------
49 | WARNING | Please do not initialize JS component in php. Do it in template
-------------------------------------------------------------------------------------------------------------------------------
Additional Notes
It's probably false positive triggering, or I'm missing something and now it's forbidden to use the <script type="text/x-magento-init"></script> script and data-mage-init="{}"attribute in phtml files.
The text was updated successfully, but these errors were encountered:
@DmitryFurs agree, it looks like\Magento2\Sniffs\Legacy\PhtmlTemplateSniff has to be split into two sniffs: one for phtml and another for PHP files. Thanks for reporting!
Preconditions
.phtml
file with<script type="text/x-magento-init">
Steps to reproduce
.phtml
file with<script type="text/x-magento-init">
phpcs
Expected result
Magento2.Legacy.PhtmlTemplate
triggeredActual result
Additional Notes
It's probably false positive triggering, or I'm missing something and now it's forbidden to use the
<script type="text/x-magento-init"></script>
script anddata-mage-init="{}"
attribute in phtml files.The text was updated successfully, but these errors were encountered: