Comments (16)
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.
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.
The same issue with newest 0.4.0. This time all <%= ... %> get replaced with
from prettier-plugin-erb.
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"
}
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.
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.
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.
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.
have the same issue
from prettier-plugin-erb.
hey guys, should be fixed in a newly released v0.2.0
from prettier-plugin-erb.
Still happening in 0.2.0
from prettier-plugin-erb.
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.
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.
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.
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.
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.
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)
- Incorrect treatment of <%== %> in html.erb files
- Migrate to Prettier v3 HOT 3
- Error formatting document: RangeError: Invalid count value HOT 1
- Ruby not formatted if it opens a block
- Please consider marking this library as deprecated HOT 2
- Fails to parse an erb multiline comment with quotes inside HOT 1
- Enabling formatOnSave for VS Code HOT 5
- Should exit with non-zero status on error
- Multiline-comment lines containing a colon are indented with each formatter run HOT 2
- Weird formatting on <i> tags with ERB (e.g. used for icons) HOT 3
- Invalid erb output for long blocks HOT 2
- Issues with leading dash in embedded ruby block HOT 2
- Why add whitespace between % and # in comments? HOT 2
- Handle 2.3 prettier changes HOT 6
- render tag <%=%> replaced with [object Object] when used in img tag HOT 16
- Support file extension .html+*.erb for rails and viewcomponent variants
- <% %> Delete HOT 7
- TypeError: formattedExpression.trim is not a function HOT 9
- Incorrect output </eext8><br/> HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettier-plugin-erb.