Fix loop validation for options_by_name keys with spaces#1205
Open
omribz156 wants to merge 1 commit into
Open
Conversation
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.
What are you adding in this PR?
Fixes #1204.
LiquidHTMLSyntaxErrorloop-argument validation split loop markup on whitespace, soproduct.options_by_name['hello world'].valueswas tokenized as ifworld'].valueswere an extra loop argument. This keeps quoted index lookups together before validating the optional loop arguments.I also added single-quoted and double-quoted regression cases for
options_by_namekeys containing spaces, plus a patch changeset for@shopify/theme-check-common.What's next? Any followup issues?
None expected.
What did you learn?
The parser already accepted this Liquid expression; the false positive came from the syntax-error check's secondary loop-argument tokenizer.
Tophatting
No screenshots included because this is a diagnostic/autofix logic change covered by tests.
Before you deploy
changesetVerification
yarn vitest run packages/theme-check-common/src/checks/liquid-html-syntax-error/checks/InvalidLoopArguments.spec.tsyarn vitest run packages/theme-check-common/src/checks/liquid-html-syntax-erroryarn workspace @shopify/theme-check-common type-checkyarn prettier --check packages/theme-check-common/src/checks/liquid-html-syntax-error/checks/utils.ts packages/theme-check-common/src/checks/liquid-html-syntax-error/checks/InvalidLoopArguments.spec.ts .changeset/fix-options-by-name-spaces.mdgit diff --checkThis was implemented with Codex assistance, with the patch kept focused and manually reviewed.