-
Notifications
You must be signed in to change notification settings - Fork 41
allow UndefinedObject check to work on snippets #891
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
Conversation
537d34d
to
2c7bd3e
Compare
cc @macournoyer !! YEARS LATER, WE FINALLY DID IT! 😂 |
Functionally looks good! One thing we can consider: **How will this impact existing themes? ** When this gets released, users on the newest version of theme-tools will get warnings on all snippets. This raises 2 potential concerns: LiquidDoc is not released yet so users can't resolve the warning on their saved theme
Users are forced to adopt LiquidDoc
Admittedly, I'm not intimately familiar with this specific check, so please feel free to share your thoughts! |
OMG!! How far we've come 👏 |
@jamesmengo, tough one. Some snippets might not have args so it might feel extra verbose for a dev to add the Maybe we need a setting? Maybe we need an auto-fix that adds the Maybe a
|
Could we keep this check disabled for snippets if you don't have i.e.
|
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.
Thank you for this PR, @EvilGenius13!
I'd be happy to sync on this as well! I believe we could:
- Adopt Alok's approach and keep this check disabled for snippets/blocks without the
{% doc %}
tag - Add a new check that lints snippets/blocks that don't have the
{% doc %}
tag but have undefined objects (this would be helpful, as users could choose to disable only this particular check if they prefer) It would also be great to include a fixer that automatically adds{% doc %}\n{% enddoc %}
- Add a new fixer to include any missing parameters in the
{% doc %}
7935294
to
49e785d
Compare
49e785d
to
2ea8095
Compare
}); | ||
return foundDocTag; | ||
} | ||
|
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.
hasLiquidDoc
is meant as a helper to detect the presence of doc tags but without building the arrays of what's inside the nodes. This should be a bit more performant if we're simply trying to check if `{% doc %} {% enddoc %} are in a file
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.
Im okay with you using extractDocDefinition
as well to check if liquidDoc is defined; but i can see the benefit of keeping this light as possible. 👍
Thanks for everyone talking about the options we have! For now we have added an extra check in the |
}); | ||
return foundDocTag; | ||
} | ||
|
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.
Im okay with you using extractDocDefinition
as well to check if liquidDoc is defined; but i can see the benefit of keeping this light as possible. 👍
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.
Thank you, @EvilGenius13!
What are you adding in this PR?
Closes: https://github.com/Shopify/developer-tools-team/issues/668
The
UndefinedObject
check would not look at snippet files. Now that we have liquiddoc support for them, we can amend the check to work on snippets.Testing
{{ mage }}
and make sure it's caught asUndefinedObject
Before you deploy
changeset
yarn build
and committed the updated configuration files