Using stylesheet tag with hyphens results in incorrect "tag was never closed" SyntaxError
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 11.9k
- Forks
- 1.5k
- Avg merge
- 17h 55m
- Merged PRs (30d)
- 3
Description
Describe the bug
theme-check erroneously claims that stylesheet tags using hyphens are not closed.
Expected
{%- stylesheet -%}
<CSS Rules>
{%- endstylesheet -%}
Should not result in any reported errors.
Actual
theme-check response:
'stylesheet' tag was never closedtheme-check[SyntaxError](https://github.com/Shopify/theme-check/blob/main/docs/checks/syntax_error.md)
Stack trace
none
Debugging information
- OS Linux
- theme-check
1.11.0
Additional context
Removing the hyphens like below fixes the error however:
{% stylesheet %}
<CSS Rules>
{% endstylesheet %}
Even if there is a rule that stylesheet tags should not have the new-line preventing hyphens (not stated anywhere that I am aware of), the tag was never closed error would not be the correct classification.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue through theme-check using the hyphenated stylesheet and endstylesheet tags shown in the report, then trace how the parser handles those delimiters. Compare that path with the non-hyphenated example. Done means the hyphenated form produces no SyntaxError while the existing form remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100