prettier/prettier-eslint

indentation in HTML file not working

Qythyx opened this issue · 1 comments

Versions:

  • prettier-eslint version: 12.0.0
  • node version: v12.22.6
  • npm (or yarn) version: 6.14.15

Have you followed the debugging tips?

Yes

Relevant code or config

<body>
    <script>
        const text = 'very ... very long text';
    </script>
...
</body>

What I did:

using the rule:

        "operator-linebreak": [
            "error",
            "before"
        ]

eslint.js --fix file.html

What happened:

The text was formatted as:

<body>
    <script>
        const text
 = 'very ... very long text';
    </script>
...
</body>

but I expected it to be indented as in:

<body>
    <script>
        const text
            = 'very ... very long text';
    </script>
...
</body>

Problem description:

Indentation doesn't seem to work. I believe this is limited to the situations when the Javascript is embedded in a HTML file and it works correctly in a .js file.

Suggested solution:

The HTML indentation should be taken into account.

https://antfu.me/posts/why-reproductions-are-required

Feel free to comment to provide a minimal but runnable reproduction.