Shopify / theme-check

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

SyntaxError - Unable to escape whitespace from schema tags #705

Open gyotov opened 1 year ago

gyotov commented 1 year ago

The theme check throws an error, when trying to escape whitespaces from schema tags in liquid. Example:

{% schema %}
  "name": "Section 1",
  "settings": []
{% endschema %}

This causes the section to render whitespaces, regardless if there is anything to render, based on certain logic:

image

The solition is to escape the whitespaces from the schema tags:

{%- schema -%}
  "name": "Section 1",
  "settings": []
{%- endschema -%}

image

While this works as expected, the theme check throws an error:

image

The only acceptable solution in this case is to omit the new line at EOF, but this is not a good practise.