Shopify/packwerk

[Bug Report] Syntax error when rendering two partials

DanielaVelasquez opened this issue · 1 comments

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: %>

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.