Skip to content

Conversation

@shoplando
Copy link
Contributor

@shoplando shoplando commented Oct 2, 2025

What are you adding in this PR?

Solves #826
Updated theme check to support doc tag inside of snippet tag. This change allows the doc tag to be used within inline snippets, in addition to the previously supported snippet and block contexts.

This PR also makes the theme check more rigorous by ensuring the doc tag is either:

  • at the top level of a snippet/block file, OR
  • a direct child of the snippet tag

The error message has been updated to reflect this new support, and tests have been added to verify that doc tags inside inline snippets don't trigger errors.

What's next? Any followup issues?

Update the theme check docs

Before you deploy

  • This PR includes a new checks or changes the configuration of a check
  • I included a minor bump changeset
  • I've made a PR to update the shopify.dev theme check docs if applicable.

Copy link
Contributor Author

shoplando commented Oct 2, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@shoplando shoplando mentioned this pull request Oct 2, 2025
2 tasks
@shoplando shoplando marked this pull request as ready for review October 2, 2025 14:17
@shoplando shoplando requested a review from a team as a code owner October 2, 2025 14:17
@shoplando shoplando force-pushed the introduce-doc-tag-inside-snippet-tag branch 2 times, most recently from 4136c01 to 209fe79 Compare October 3, 2025 14:22

context.report({
message: `The \`${docTagName}\` tag can only be used within a snippet or block.`,
message: `The \`${docTagName}\` tag can only be used at the top level of a snippet or block file, or as a direct child of an inline snippet tag.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) Wondering if this could be clearer but nothing better is springing to mind. Might be worth workshopping a little bit to get "at the top level of" clearer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I totally agree, I'll try to come up with something clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does "The `${docTagName}` tag cannot be nested inside Liquid tags except for snippet tags." sound?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throwing in my two cents. Would it make sense to offer two different messages?
We keep the message for doc tags in snippets and blocks as The \${docTagName}\ tag can only be used at the top level of a snippet or block file
and then have a separate one triggered for inline snippets like `The ${docTagName} tag can only be used inside an inline snippet at the top level. (I don't have a good message for this)

My only reason for this is that the doc tags are now serving a purpose in different ways that would be confusing in one message.

We're top level only within blocks and snippet files but if we have an inline snippet that can be placed anywhere, it actually goes top level within the snippet itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah that's actually a great idea, I'll make two separate messages for the two cases

Copy link
Contributor

@dejmedus dejmedus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎩 looks great!

Image

@shoplando shoplando force-pushed the introduce-doc-tag-inside-snippet-tag branch 3 times, most recently from 1c33a1e to a47fc50 Compare October 3, 2025 19:44
@shoplando shoplando force-pushed the introduce-doc-tag-inside-snippet-tag branch from a47fc50 to 391578c Compare October 8, 2025 20:34
@shoplando shoplando changed the base branch from include-snippet-in-ohm to graphite-base/1067 October 9, 2025 15:27
@shoplando shoplando changed the base branch from graphite-base/1067 to make-undefined-object-theme-check-accept-inline-snippets October 9, 2025 15:28
@shoplando shoplando deleted the branch make-undefined-object-theme-check-accept-inline-snippets October 9, 2025 15:31
@shoplando shoplando closed this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants