-
Notifications
You must be signed in to change notification settings - Fork 77
Updated the undefined-object theme check to skip over inline-snippets #1071
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@shopify/theme-check-common': minor | ||
| --- | ||
|
|
||
| Updated the `Undefined-object` theme check to skip over the new `snippet` tags |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,6 +142,10 @@ export const UndefinedObject: LiquidCheckDefinition = { | |
| const parent = last(ancestors); | ||
| if (isLiquidTag(parent) && isLiquidTagCapture(parent)) return; | ||
|
|
||
| if (parent?.type === NodeTypes.RenderMarkup && parent.snippet === node) return; | ||
|
|
||
| if (isLiquidTag(parent) && parent.name === 'snippet' && parent.markup === node) return; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this supposed to be a temporary fix or something instead of just adding it our list of valid liquid tags?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I already added
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this because we load the tags from a different repo?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that repo is used for the documentation, autocomplete and validation of the tag itself. And also the |
||
|
|
||
| variables.push(node); | ||
| }, | ||
|
|
||
|
|
||
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.
So i think you have the right logic, but i think you need to modify the logic on line 48:
This might not make too much sense, but here is the logic:
doctagdoctag because technically, you can pass ANYTHING into snippets, and without adoctag we don't really know which one is Defined, and which one isn'tdoctag inside the inline snippets don't mean the top-level snippet file has one too...So we need a robust solution that works for the following situations:
I think we need to layout each situation before full implementation of this
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.
Ok so basically we would want:
And when the doc tag is inside the inline snippet, the check will be activated only on the inside of the inline snippet, and not outside of it.
I'll implement this right now.