Shopify / Shopify/theme-tools

Support prettier-ignore-start / prettier-ignore-end in Liquid templates

Open
#1,150 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
234
Forks
92
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Is your feature request related to a problem? Please describe.
Currently, @shopify/prettier-plugin-liquid does not support prettier-ignore-start / prettier-ignore-end for range-based ignores. Only node-level {% # prettier-ignore %} comments are supported.
This makes it cumbersome to preserve intentional formatting or whitespace across larger sections of Liquid templates.

Describe the solution you'd like
Support standard Prettier range ignore comments:

<!-- prettier-ignore-start -->
<div class="custom-layout">
  {{ some_variable | complicated_filter: foo: bar }}
  {% render 'component', foo: bar %}
</div>
<!-- prettier-ignore-end -->

or

{% comment %} prettier-ignore-start {% endcomment %}
<div class="custom-layout">
  {{ some_variable | complicated_filter: foo: bar }}
  {% render 'component', foo: bar %}
</div>
{% comment %} prettier-ignore-end {% endcomment %}

Describe alternatives you've considered

  • Using {% # prettier-ignore %} before every node — works but is verbose and noisy.
  • Disabling formatting for the entire file via .prettierignore — too coarse-grained.

Checklist

  • I have checked and made sure that the proposal adheres to this plugin's principles

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

Start in packages/prettier-plugin-liquid and review the plugin principles at docs/prettier-plugin-liquid/principles/index.md. Determine how the existing node-level {% # prettier-ignore %} handling works, then support the HTML-comment and Liquid-comment range forms so formatting is preserved between the start and end markers.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 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.