-
Notifications
You must be signed in to change notification settings - Fork 29
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
Introducing UndefinedObject
check
#115
Conversation
packages/theme-check-common/src/checks/undefined-object/index.ts
Outdated
Show resolved
Hide resolved
packages/theme-check-common/src/checks/undefined-object/index.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.
Really excellent work. Only needs the access
logic from TypeSystem and ready to go after.
Co-authored-by: CP Clermont <cp.clermont@shopify.com>
- Eliminate unnecessary usage of `node.blockEndPosition` since the `assign` tag doesn't have a corresponding end tag - Implement `docset->objects[0]->access` logic to consider only global objects during this check
Thanks a lot for the review, @charlespwd! Changes applied :) |
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.
Lesgoo
Fixes https://github.com/Shopify/theme-check-js/issues/66
--demo.mp4
What are you adding in this PR?
The
UndefinedObject
check is being introduced to identify references to undefined Liquid objects.This implementation largely mirrors the Ruby version, and intentionally skips snippet assets. This is because these assets depend on variables defined in parent templates, and Theme Check is designed to focus on single asset checks.
Looking ahead, the following issue is planned to be addressed next: #114. Once resolved, developers will be able to annotate available variables, thereby establishing an interface/contract between Liquid templates.
Finally, this check doesn't currently provide a fix or suggestion, as the main approaches would be about (1) removing the variable or (2) ignoring the check. To enhance this, I've opened a new issue: #113. This proposes a global 'ignore check' implementation, so all checks will be able to suggest an ignore dialog. I don't foresee this leading to overuse of the ignore function, as I the ignore-code introduces some noise.
Before you deploy
changeset
to this PR