Skip to content

theme-check incorrectly flags options_by_name keys containing spaces as invalid #1204

Description

@david-w-shopify

Describe the bug
When a quoted string including a space is included within the opening line of a forloop, theme-check incorrectly reports is as invalid syntax.

Source

{%- for value in product.options_by_name['hello world'].values -%}
  {{ value }}
{%- endfor -%}

Expected behaviour

The syntax is fine - there are no issues using this syntax in a theme, so there should be no reported theme-check errors.

Actual behaviour

A syntax error is reported after the space in the quoted string.

Image

Also when theme-check tries to autofix the error on save, it actually creates broken syntax.

The snippet described earlier gets "corrected" to

{%- for value in product.options_by_name['hello -%}
  {{ value }}
{%- endfor -%}

I suspect simply not flagging the error to begin would prevent this.

Debugging information

  • OS [e.g. Windows, Mac, Linux]: Mac
  • OS Version: Tahoe 26.3.1 (a)
  • Theme Check Version [e.g. 0.1.0]: 3.94.1 (shopify-cli, I'm not sure if theme check has a different version or where I'd find it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions