Asim-Tahir / prettier-plugin-jinja-template-repro-8

`prettier-plugin-jinja-template` prettier plugin 8th issue reproduction repository

Repository from Github https://github.comAsim-Tahir/prettier-plugin-jinja-template-repro-8Repository from Github https://github.comAsim-Tahir/prettier-plugin-jinja-template-repro-8

prettier-plugin-jinja-template 8th Issue Reproduction

This repository is a reproduction of the issue described in prettier-plugin-jinja-template#8.

Steps to reproduce

  1. Clone this repository

  2. Run yarn install or yarn

    Note

    If you don't have yarn, you can install it with corepack enable if nodejs version is >= 14.19.0 or >= 16.9.0

  3. Preview the input file before formatting:

    $ cat unformatted.jinja
    {% with text='text', version=1 %}
       {% include 'directory/template.jinja2' %}
    {% endwith %}
    
    {% with text='text', version=1 %}
       {% include 'directory/template.jinja2' %}
    {% endwith %}
    
    <div>
       {% with text='text', version=1 %}
          {% include 'directory/template.jinja2' %}
       {% endwith %}
    </div>
  4. Run yarn lint to preview formatted output

    ❯ yarn lint
    yarn run v1.22.19
    $ prettier *.jinja
    {% with text='text', version=1 %}
    {% include 'directory/template.jinja2' %}
    {% endwith %}
    {% with text='text', version=1 %}
    {% include 'directory/template.jinja2' %}
    {% endwith %}
    
    <div>
    {% with text='text', version=1 %}
       {% include 'directory/template.jinja2' %}
    {% endwith %}
    </div>
    ✨  Done in 0.52s.
  5. Run yarn lint@fix to format the input file:

    ❯ yarn lint@fix
    yarn run v1.22.19
    $ prettier --write *.jinja
    unformatted.jinja 19ms
    ✨  Done in 0.56s.
  6. Preview formatted output:

    ❯ cat unformatted.jinja
    {% with text='text', version=1 %}
    {% include 'directory/template.jinja2' %}
    {% endwith %}
    {% with text='text', version=1 %}
    {% include 'directory/template.jinja2' %}
    {% endwith %}
    
    <div>
    {% with text='text', version=1 %}
       {% include 'directory/template.jinja2' %}
    {% endwith %}
    </div>

Expected behavior

Expected output looks like this:

{% with text='text', version=1 %}
  {% include 'directory/template.jinja2' %}
{% endwith %}
{% with text='text', version=1 %}
  {% include 'directory/template.jinja2' %}
{% endwith %}

<div>
  {% with text='text', version=1 %}
    {% include 'directory/template.jinja2' %}
  {% endwith %}
</div>

Actual behavior

Actual output is:

{% with text='text', version=1 %}
  {% include 'directory/template.jinja2' %}
{% endwith %}
{% with text='text', version=1 %}
  {% include 'directory/template.jinja2' %}
{% endwith %}

<div>
  {% with text='text', version=1 %}
    {% include 'directory/template.jinja2' %}
  {% endwith %}
</div>

Environment

About

`prettier-plugin-jinja-template` prettier plugin 8th issue reproduction repository


Languages

Language:Jinja 52.9%Language:JavaScript 47.1%