Shopify / Shopify/theme-tools

Fix this indentation inference bug

Open
#378 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:prettier-plugin Bug Severity: 3
Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Describe the bug
Indentation inference bug

Unformatted source

<details
  class="group/level-2"
  x-trap="getIsMobileNavItemActive('{{ link_forloop.index }}-{{ link_link_forloop.index }}')"
  @header-mobile-nav-items-active-change.window="
    () => mobileNavItemsActiveChangeEvent($event, '{{ link_forloop.index }}-{{ link_link_forloop.index }}')
  "
>
</details>

Expected output

<details
  class="group/level-2"
  x-trap="getIsMobileNavItemActive('{{ link_forloop.index }}-{{ link_link_forloop.index }}')"
  @header-mobile-nav-items-active-change.window="
    () => mobileNavItemsActiveChangeEvent($event, '{{ link_forloop.index }}-{{ link_link_forloop.index }}')
  "
>
</details>

Actual output

<details
  class="group/level-2"
  x-trap="getIsMobileNavItemActive('{{ link_forloop.index }}-{{ link_link_forloop.index }}')"
  @header-mobile-nav-items-active-change.window="
        () => mobileNavItemsActiveChangeEvent($event, '{{ link_forloop.index }}-{{ link_link_forloop.index }}')
  "
></details>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides Liquid input, expected output, and actual output, but names no file, test, or entry point. Start by tracing the formatter's indentation-inference path for this case, then add a regression test for the expected output and confirm the extra indentation is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.