Recognize schema settings as block variables in UndefinedObject - #1319
Merged
Merged
Conversation
charlespwd
marked this pull request as ready for review
October 1, 2026 14:19
karreiro
approved these changes
Oct 1, 2026
karreiro
left a comment
Contributor
There was a problem hiding this comment.
Thank you, @charlespwd 🚀
clauderic
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this PR
UndefinedObjectnow treats a theme block's schema settings as defined variables. A block can use{{ heading }}for itsheadingsetting without repeating it as a LiquidDoc@param.Problem
Inside a theme block, a schema setting is available as both
{{ heading }}and{{ block.settings.heading }}. Block-call validation, completion, and hover already follow that rule.UndefinedObjectonly knew about LiquidDoc parameters andcontent, so it flagged every bare schema setting.So if
blocks/card.liquidis:mainreports:Solution
In a block file,
UndefinedObjectaskscontext.getBlockParametersfor the current block and adds every name it returns to the file's defined variables. Block-call validation and block-tag completion and hover use the same resolver, so the check gets the same variable set:content.Names declared by both schema and LiquidDoc count as one variable. Any other unknown root is still reported.
Boundaries:
headerandparagraphentries don't define variables, and neither do settingtypevalues such ascolor_background.contentstay defined, as before.Reproduction and checks
does not report a schema setting used as a bare variablefailed onmainwithUnknown object 'heading' used.and passes with this change. Without the fix, 5 of the 9 new tests fail. The other 4 cover behavior that stays the same.CI=1 pnpm exec vitest run packages/theme-check-common/src/checks/undefined-object/index.spec.ts: 46 passedCI=1 pnpm exec vitest run packages/theme-check-common: 5,365 passedpnpm --filter @shopify/theme-check-common type-checkpnpm format:checkgit diff --checkBefore you deploy
changeset