-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use optional jsonc on schema tags #815
Comments
JSON5 is not supported as formatted by prettier, because it does not allow identifiers as object keys. |
I've been testing and it seems that shopify accepts the output for jsonc files perfectly, so I've updated the issue and it can be reopen. |
This is the output of using jsonc: {% schema %}
{
/* coment */
"name": "Slideshow",
"tag": "section",
"class": "slideshow",
"limit": 1, // comment
"settings": [
{
"type": "text",
"id": "title",
"label": "Slideshow",
},
],
"max_blocks": 5,
"blocks": [
{
"name": "Slide",
"type": "slide",
"settings": [
{
"type": "image_picker",
"id": "image",
"label": "Image",
},
],
},
],
"presets": [
{
"name": "Slideshow",
"settings": {
"title": "Slideshow",
},
"blocks": [
{
"type": "slide",
},
{
"type": "slide",
},
],
},
],
"locales": {
"en": {
"title": "Slideshow",
},
"fr": {
"title": "Diaporama",
},
},
"enabled_on": {
"templates": ["*"],
"groups": ["footer"],
},
}
{% endschema %} |
It seems that jsonc support were just added on prettier v3.2, so this option won't work with prettier v2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Shopify added support for comments and trailing commas for the theme files. Prettier have support for those using
JSON5JSONC parser and prettier can use that format on the*.json
files (with some config), but the liquid plugin does not permit using that format on the json embedded on liquid files (on the schema tag).As far as I could test, shopify accepts the prettier output for jsonc format, so it would make the prettier plugin output easier to review, so adding support there would match the principles.
That said, this feature cannot be implemented directly, because it would introduce an unexpected failure, as it would make code that was correct, now be incorrect. So we would need to add a setting (false by default until the next mayor version) to use jsonc format for the json embedded on the liquid files. With the setting, developers could choose when to migrate to JSONC format on the files.
Checklist
The text was updated successfully, but these errors were encountered: