Shopify / prettier-plugin-liquid

Prettier Liquid/HTML plugin
https://npm.im/@shopify/prettier-plugin-liquid
MIT License
94 stars 15 forks source link

SchemaJsonFormat in themecheck uses different rules for empty arrays? #152

Closed andyxmas closed 1 year ago

andyxmas commented 1 year ago

Describe the bug with SchemaJsonFormat enbabled in theme check, the below unformatted source is reported as a style that could be improved. This is how prettier will format the code however.

Unformatted source

{% schema %}
{
  "name": "Main Search",
  "tag": "section",
  "class": "section",
  "settings": []
}
{% endschema %}

Expected output ( *this is what 'quick fix' in vscode using theme-check formats it to

{% schema %}
{
  "name": "Main Search",
  "tag": "section",
  "class": "section",
  "settings": [

  ]
}
{% endschema %}

Actual output (see unformatted source)

Debugging information

Additional context There's a good argument to not have an empty array here, but as I see this in our code a lot, feel like it would be good if the two could be aligned. Its possible that I could resolve this with htmlWhitespaceSensitivity, but suspect that would have wider impact that just this.

andyxmas commented 1 year ago

My workaround is to disable SchemaJsonFormat in theme-check. Perhaps this is actually the long term solution to ensure the two don't conflict here?

andyxmas commented 1 year ago

Ah, just seen https://github.com/Shopify/theme-tools/issues/409 - closing this.