Skip to content

Fix loop validation for options_by_name keys with spaces#1205

Open
omribz156 wants to merge 1 commit into
Shopify:mainfrom
omribz156:codex/fix-options-by-name-space-key
Open

Fix loop validation for options_by_name keys with spaces#1205
omribz156 wants to merge 1 commit into
Shopify:mainfrom
omribz156:codex/fix-options-by-name-space-key

Conversation

@omribz156
Copy link
Copy Markdown

What are you adding in this PR?

Fixes #1204.

LiquidHTMLSyntaxError loop-argument validation split loop markup on whitespace, so product.options_by_name['hello world'].values was tokenized as if world'].values were 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_name keys 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

  • I added screenshots of the changes (before and after the changes if applicable)

No screenshots included because this is a diagnostic/autofix logic change covered by tests.

Before you deploy

  • I included a patch bump changeset

Verification

  • yarn vitest run packages/theme-check-common/src/checks/liquid-html-syntax-error/checks/InvalidLoopArguments.spec.ts
  • yarn vitest run packages/theme-check-common/src/checks/liquid-html-syntax-error
  • yarn workspace @shopify/theme-check-common type-check
  • yarn 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.md
  • git diff --check

This was implemented with Codex assistance, with the patch kept focused and manually reviewed.

@omribz156 omribz156 requested a review from a team as a code owner May 18, 2026 13:54
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.

theme-check incorrectly flags options_by_name keys containing spaces as invalid

1 participant