Git Product home page Git Product logo

Comments (16)

mason-stewart avatar mason-stewart commented on July 4, 2024 8

This continues to be an issue in 0.4.0. Here's the dev deps from my packson.json

  "devDependencies": {
    "@prettier/plugin-ruby": "^1.6.1",
    "prettier": "^2.4.0",
    "prettier-plugin-erb": "^0.4.0"
  }

I've confirmed that this happens in my terminal yarn run prettier --write foo/bar.html.erb and isn't being caused by a conflicting VS Code plugin. Thanks!

[EDIT]

For reference, per @karthikkasturi's comment above, version locking these specific versions of each dep fixes the issue:

  "devDependencies": {
    "@prettier/plugin-ruby": "1.5.5",
    "prettier": "2.2.0",
    "prettier-plugin-erb": "0.2.0"
  }

from prettier-plugin-erb.

karthikkasturi avatar karthikkasturi commented on July 4, 2024 7

Downgrading to 2.2.0 helped, thanks!

Current config:
"@prettier/plugin-ruby": "^1.5.5",
"prettier": "2.2.0",
"prettier-plugin-erb": "^0.2.0",

from prettier-plugin-erb.

molfar avatar molfar commented on July 4, 2024 4

The same issue with newest 0.4.0. This time all <%= ... %> get replaced with

from prettier-plugin-erb.

kvnloughead avatar kvnloughead commented on July 4, 2024 3

Same issue with the more recent versions, except is was happening with <% %> instead of <%= %>. These versions:

"devDependencies": {
    "@prettier/plugin-ruby": "^3.1.2",
    "prettier": "^2.6.2",
    "prettier-plugin-erb": "^0.4.0"
  }

image

Locking the versions from the post above seems to resolve that issue, but created another issue, reported elsewhere, replacing <%= foo %> with [object Object] inside <title> . Changing to these versions seems to work

{
  "devDependencies": {
    "@prettier/plugin-ruby": "1.5.5",
    "prettier": "2.2.0",
    "prettier-plugin-erb": "0.4.0"
  }
}

from prettier-plugin-erb.

adamzapasnik avatar adamzapasnik commented on July 4, 2024 2

Which prettier version are you using? 🤔 if it's 2.3 downgrade it to 2.2.x. If it's not that, then I'm gonna have a look at it tomorrow 😓

from prettier-plugin-erb.

ziadsawalha avatar ziadsawalha commented on July 4, 2024 2

Hi @adamzapasnik - this is pretty serious issue since it can overwrite/corrupt/undo people's code. May I suggest placing a very loud warning on the readme or taking this plugin off the VS Code marketplace until it is fixed.

Especially since erb files can be treated as HTML but for the handling of these expressions, which is how I came across the plugin.

from prettier-plugin-erb.

archonic avatar archonic commented on July 4, 2024 1

I version locked to the following per @mason-stewart's suggestion:

"devDependencies": {
  "@prettier/plugin-ruby": "1.5.5",
  "prettier": "2.2.0",
  "prettier-plugin-erb": "0.2.0"
}

And the following line:

<main role="main" class="h-full px-5 py-2 text-slate-900 dark:text-slate-50 <%= 'bg-gradient-to-tr from-slate-100 to-indigo-100 dark:from-slate-900 dark:to-indigo-900' if controller.controller_name == "static_pages" %>">

was changed to:

<main
  role="main"
  class="[object Object] h-full px-5 py-2 text-slate-900 dark:text-slate-50"
>

I'm not saying this to be mean, but this is a poor enough introduction to this plugin that I'm just going to abandon it.

from prettier-plugin-erb.

molfar avatar molfar commented on July 4, 2024

have the same issue

from prettier-plugin-erb.

adamzapasnik avatar adamzapasnik commented on July 4, 2024

hey guys, should be fixed in a newly released v0.2.0

from prettier-plugin-erb.

karthikkasturi avatar karthikkasturi commented on July 4, 2024

Still happening in 0.2.0

image

image

from prettier-plugin-erb.

michaelzim avatar michaelzim commented on July 4, 2024

Even with the latest version I still see this happening in <textarea> elements.

packages:
[email protected]
@prettier/[email protected]
[email protected]

input:
<textarea><%= 123 %></textarea>

output:
<textarea> <eext1 /> </textarea>

from prettier-plugin-erb.

abdullah-kasim avatar abdullah-kasim commented on July 4, 2024

The following .html.erb is an easily reproducible scenario:

<script>
  <% if CONSTANT_2 == 'asd' %>

          var a = '<%= CONSTANT_1 %>'

  <% else %>
          var a = '<%= CONSTANT_3 %>'
  <% end %>
</script>

On prettier 2.2.0 and 2.2.1, it produces the following:

<script>
  <% if CONSTANT_2 == 'asd' %>


            var a = '<%= CONSTANT_1 %>'


  </eext1> <eext3>
            var a = '<%= CONSTANT_3 %>'
  <% end %>
</script>

from prettier-plugin-erb.

MattBudz avatar MattBudz commented on July 4, 2024

I'm seeing the same issue with:

  • VSCode: 1.73.0
  • Prettier: 2.7.1
  • plugin-ruby: 3.2.2
  • plugin-erb: 0.4.0

from prettier-plugin-erb.

drale2k avatar drale2k commented on July 4, 2024

Any solution here except downgrading way back to 2.2.0? I am having the same issue with the following versions:

"@prettier/plugin-ruby": "^3.2.2",
"prettier": "^2.8.0",
"prettier-plugin-erb": "^0.4.0"

from prettier-plugin-erb.

drewlustro avatar drewlustro commented on July 4, 2024

Absolutely bizarre... my installation was working for weeks up until today. Seeing <eext /> left and right.

My package.json has conservative versions pinned... not sure why this would suddenly occur.

Did something change with a VSCode update that caused everything to break?

from prettier-plugin-erb.

BaggioGiacomo avatar BaggioGiacomo commented on July 4, 2024

I have the same when I've installed the @shopify/prettier-plugin-liquid package 👎🏻

  "@prettier/plugin-ruby": "1.6.1",
  "@shopify/prettier-plugin-liquid": "1.0.6",
  "prettier-plugin-erb": "0.4.0"

from prettier-plugin-erb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.