Shopify/theme-tools

Avoid parser blocking scripts by adding `defer` or `async` on this tagtheme-checkParserBlockingScript -- ignores all settings

Seikilos opened this issue · 2 comments

Describe the bug

The code <script src="js/chart.js/dist/chart.umd.js"></script>
causes Avoid parser blocking scripts by adding deferorasync on this tagtheme-checkParserBlockingScript
despite having set these things:

{% # theme-check-disable ParserBlockingJavaScript %}

and also in .theme-check.yml

ParserBlockingJavascript:
  enabled: false
  ignore: []

ParserBlockingScriptTag:
  enabled: false
  ignore: []
  

Source

{% # theme-check-disable ParserBlockingJavaScript %}

<script src="js/chart.js/dist/chart.umd.js"></script>

{% # theme-check-enable ParserBlockingJavaScript %}

Expected behaviour
No warning because at least one setting for muting ParserBlockingJavaScript should be honored

Actual behaviour
Avoid parser blocking scripts by adding deferorasync on this tagtheme-checkParserBlockingScript Message pops up in visual studio code
image

Debugging information

  • Windows
  • 22H2
  • VS Code 1.86.2
  • Shopify Liquid Extension Version v2.12

Additional context
Add any other context about the problem here.

Ah. This check was merged into one with the theme-check 2.0 migration. I don't think we have code that checks for aliases for the disable comment behaviour. We'll have to fix that.

https://shopify.dev/docs/themes/tools/theme-check/migrate#:~:text=ParserBlockingJavaScript,ParserBlockingScript

It's named ParserBlockingScript now. One check for both types.

In the meantime, until we have support for disabling checks with the aliases, you can change your comment to that instead.

Thanks for reporting!

@charlespwd that did the trick. Thanks for the explanation!

Does this need a vs code update to ship, or is this merely a documentation issue? You could technically add a hint on this to the current docs for all people coming from the VS code extension.