theme-tools icon indicating copy to clipboard operation
theme-tools copied to clipboard

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

Open Seikilos opened this issue 1 year ago • 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.

Seikilos avatar Mar 01 '24 16:03 Seikilos

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 avatar Mar 01 '24 19:03 charlespwd

@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.

Seikilos avatar Mar 02 '24 07:03 Seikilos

closing as wont fix since we're moving forward with theme check written in typescript

mgmanzella avatar Oct 17 '24 19:10 mgmanzella