eslint - How to validate JSON in Shopify Liquid templates in VS Code?
Recently there was a bug caused by a missing comma below inside a Shopify Liquid template:
{% schema %}
{
...
"settings": [
{
"type": "header",
"content": "Content"
}
{
"type": "text",
"id": "title",
"label": "Title"
}
],
...
}
{% endschema %}
Is there a way to automatically show that red squiggly line in VS Code to indicate that the JSON is malformed? I tried adding this to my user settings but no luck:
"eslint.validate": [
"javascript",
"javascriptreact",
{ "language": "liquid" }
]
I have the ESLint and Liquid (Neil Ding) extensions installed.
Answer
Solution:
Shopify has some tools for that, you should install theme check and shopify cli (https://shopify.dev/themes/tools/theme-check/vscode)
Source
Didn't find the answer?
Our community is visited by hundreds of Shopify development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.