Shopify / theme-check

The Ultimate Shopify Theme Linter
Other
333 stars 96 forks source link

AssetPreload should lint only 1st party assets #693

Open nickbabcock opened 1 year ago

nickbabcock commented 1 year ago

Describe the bug

The AssetPreload lint fires on the following line:

<link rel="preload" as="script" href="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js">

If we take the suggestion and preload this 3rd party asset with the preload_tag

{{ 'https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js' | preload_tag: as: 'script' }}

Shopify will return the following liquid error on page load:

Liquid error: Input must be a theme or shop asset URL. 

Expected

I expected that either the preload_tag would work with 3rd party assets or that the AssetPreload wouldn't give a false positive that leads to a liquid error.

Additional context

theme-check --version
1.12.1