-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add JsonMissingBlock
Check
#651
Conversation
05b1074
to
d7436b4
Compare
packages/theme-check-common/src/checks/json-missing-block/index.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed that if I just open my json file and put whatever non-existent type as a block type, it doesn't complain. It will only complain if that non-existent block type is also in the parent's schema as an accepted block. Is that by design? I was wonder if we should verify the json block types for existence independently of the schema, but I figured maybe there's a reason for this behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have that issue with onCodePathEnd
checks not running when the editor opens, but rather on refocusing on the file tab, but that's not strictly related to this check. Otherwise, I tophatted and code lgtm.
Bit of a captain obvious but I'll write it out just in case, but I didn't check that the util functions don't duplicate logic that's also used elsewhere and that we'd benefit from extracting out of that check. I'm thinking you just kept that's specific to that check in there. |
packages/theme-check-common/src/checks/json-missing-block/index.spec.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change LGTM and tophats as expected! Great work Nav! I added one minor nit but feel free to ingore 😏
What are you adding in this PR?
Addresses https://github.com/Shopify/shopify/issues/552694
This PR introduces enhanced validation checks for JSON template files, specifically ensuring that:
blocks/
dirsection
orblock
at the root-levelWhat's next? Any followup issues?
With this being a new check, we will want to update https://github.com/Shopify/shopify-dev so users can understand their errors. Developer Docs changes: https://github.com/Shopify/shopify-dev/pull/51342
What did you learn?
I have never worked or come across JSON template files before so this was fun to learn about.
Before you deploy
changeset
allChecks
array insrc/checks/index.ts
yarn build
and committed the updated configuration filestheme-app-extension.yml
configchangeset
changeset