prettier-plugin-eex icon indicating copy to clipboard operation
prettier-plugin-eex copied to clipboard

Eex expressions converted to eextN

Open zoedsoupe opened this issue 3 years ago • 5 comments

Deired Behaviour format not only HTML but also eex/leex expression without buggy convertions

ActualBehaviour All eex/leex expressions are converted to eextN where N is the "index" of expression. So you if you have 3 expression into a template, they will be converted to:

eext1 eext2 eext3

Versions elixir: v1.12.1 erlang/OTP: v24.0.0 node: v12.22.1 yarn: v1.221 prettier: v2.2.1 prettier-plugin-eex: v0.5.0

Screenshots image

zoedsoupe avatar Jun 10 '21 01:06 zoedsoupe

@adamzapasnik any thoughts on what a fix might look like here?

Here's a minimal testcase:

Before:

<textarea>
  <%= @something %>
</textarea>

After:

<textarea>
   <eext1 /> 
</textarea>

Apart from this issue, I'm really loving this plugin. Thank you!

semanticart avatar Jun 30 '21 11:06 semanticart

Ah, it looks like we need to lock to prettier 2.2 for now: https://github.com/adamzapasnik/prettier-plugin-eex/issues/51

EDIT: actually, that doesn't work for me either. Commented on #51

semanticart avatar Jun 30 '21 11:06 semanticart

hey guys, apologies for my absence.

These are bugs not related to prettier, I'll fix them along with a migration to 2.3 prettier.

This can take a while, though. So for now, you'll have to ignore these files 😓

adamzapasnik avatar Jul 01 '21 17:07 adamzapasnik

This same issue happens to me on a fresh install of prettier 2.2.1 and prettier-plugin-eex 0.4 with no prettierrc

dzfranklin avatar Jul 16 '21 02:07 dzfranklin

May be related but I'm having this happen to files only when I add ` at the top of the file.

Before format:

<!-- prettier-ignore -->
<div class="flex-1">
  <p class="alert alert-info" role="alert"><%= get_flash(@conn, :info) %></p>
  <p class="alert alert-danger" role="alert"><%= get_flash(@conn, :error) %></p>
  <%= @inner_content %>
</div>

After format:

<!-- prettier-ignore -->
<div class="flex-1">
  <p class="alert alert-info" role="alert"> <eext1 /> </p>
  <p class="alert alert-danger" role="alert"> <eext2 /> </p>
   <eext3 /> 
</div>

Without the prettier ignore comment it works correctly.

cchauche avatar Sep 13 '21 16:09 cchauche