Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] Syntax error when rendering two partials #278

Open
DanielaVelasquez opened this issue Dec 6, 2022 · 1 comment
Open

[Bug Report] Syntax error when rendering two partials #278

DanielaVelasquez opened this issue Dec 6, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@DanielaVelasquez
Copy link

Description
Getting the error Syntax error: unexpected token tSTRING when rendering two partials one after another in a view.

To Reproduce
Reference two different partials one after another, eg:
<%= render "gsd/projects/states/dates", state: %> <%= render "gsd/projects/states/state_dates", state: %>

Expected Behaviour
It should be a valid statement.

Screenshots
Take a look at this PR and the pipeline errors

Version Information

  • Packwerk: [e.g. v2.2.2]
  • Ruby [e.g. v3.1.2p20]

Additional Context
How have you tried to solve the issue? The way to bypass the error was to use quotes for the first render
<%= render("gsd/projects/states/dates", state:) %> <%= render "gsd/projects/states/state_dates", state: %>

@DanielaVelasquez DanielaVelasquez added the bug Something isn't working label Dec 6, 2022
@alexevanczuk
Copy link
Contributor

Hi @DanielaVelasquez thank you for the bug report!

Would you like to try to put up a PR to resolve this? I'd be happy to help.

A good place to start would be going into test/unit/packwerk/parsers/erb_test.rb and adding a test that fails for your valid ERB. Then we can dive into what it would take to fix.

pezholio added a commit to alphagov/whitehall that referenced this issue Jun 17, 2024
There is an open bug in Packwerk when shorthand hash syntax is used in
views (Shopify/packwerk#278). Adding brackets
seems to fix it
pezholio added a commit to alphagov/whitehall that referenced this issue Jun 17, 2024
There is an open bug in Packwerk when shorthand hash syntax is used in
views (Shopify/packwerk#278). Adding brackets
seems to fix it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants