Comments (16)
Downgrading prettier
to 2.2.1
did the trick:
"devDependencies": {
- "@prettier/plugin-ruby": "^1.5.5",
- "prettier": "^2.3.1",
- "prettier-plugin-erb": "^0.3.0",
+ "@prettier/plugin-ruby": "^1.6.0",
+ "prettier": "2.2.1",
+ "prettier-plugin-erb": "^0.4.0",
},
Actually I also tried without upgrading prettier-plugin-erb
to 0.4.0, and it still worked as expected (no [object Object]
issue):
"devDependencies": {
"@prettier/plugin-ruby": "^1.5.5",
- "prettier": "^2.3.1",
+ "prettier": "2.2.1",
"prettier-plugin-erb": "^0.3.0",
},
from prettier-plugin-erb.
I have located the problem, will fix it tomorrow hopefully. Thanks guys for reporting.
from prettier-plugin-erb.
sorry for the wait, @karthikkasturi
I've just released a fix, please check the version 0.3.0
from prettier-plugin-erb.
Current config:
"@prettier/plugin-ruby": "^1.5.5",
"prettier": "2.2.0",
"prettier-plugin-erb": "^0.2.0",
from prettier-plugin-erb.
Also seeing this, appears to be when the ERB tag is within double quotes:
=====================================input======================================
<a href="mailto:<%= contact_email %>"><%= contact_email %></a>
=====================================output=====================================
- <a href="mailto:<%= contact_email %>"><%= contact_email %></a>
+ <a href="mailto:[object Object]"><%= contact_email %></a>
================================================================================
from prettier-plugin-erb.
any update on this? or a workaround?
from prettier-plugin-erb.
I'm seeing the issue with [object Object]
as well. But in another context.
With the following versions
{
"@prettier/plugin-ruby": "1.5.5",
"prettier": "2.2.1",
"prettier-plugin-erb": "0.3.0"
}
Running prettier on this
<script>
var custom = '<%= data.to_json %>';
</script>
would result in the following
<script>
var custom = '[object Object]';
</script>
from prettier-plugin-erb.
@marcuslilja I'll try to resolve this one over the weekend, sorry for trouble
from prettier-plugin-erb.
@marcuslilja I'll try to resolve this one over the weekend, sorry for trouble
Thanks 👍
from prettier-plugin-erb.
Same issue also happens with <pre>
elements.
Input:
<pre><%= 123 %></pre>
Output:
<pre>[object Object]</pre>
from prettier-plugin-erb.
Hey, chiming in to report the same issue, in another context:
Versions:
"@prettier/plugin-ruby": "^1.5.5",
"prettier": "^2.3.1",
"prettier-plugin-erb": "^0.3.0",
Source:
<div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="<%= image_path "icons/user-astronaut-regular.svg" %>"
>
Formatted output:
<div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="[object Object]"
>
from prettier-plugin-erb.
Released a fix, please check 0.4.0.
from prettier-plugin-erb.
Thank you @adamzapasnik... but this seems worse :/
package.json:
"devDependencies": {
- "@prettier/plugin-ruby": "^1.5.5",
+ "@prettier/plugin-ruby": "^1.6.0",
"prettier": "^2.3.1",
- "prettier-plugin-erb": "^0.3.0",
+ "prettier-plugin-erb": "^0.4.0",
"webpack-dev-server": "^3.11.2"
},
Input:
<div class="form-group mb-3">
<%= form.label :name, "Full name" %>
<%= form.text_field :name, value: params[:name] || customer.name, class: "form-control", placeholder: "First name + last name" %>
</div>
<div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="<%= image_path "icons/user-astronaut-regular.svg" %>"
>
Output:
<div class="form-group mb-3">
<eext7 />
<eext8 />
</div>
<div
class="form-group mb-3"
data-controller="avatar-field"
data-avatar-field-fallback-image-value="eex9eex"
>
from prettier-plugin-erb.
I am still having this problem even with the above package versions. It seems to only apply for ERB tags nested inside of specific other tags.
EDIT: Maybe it's broken for specific tag types? If I have an ERB tag inside of a <p>
it's fine, but inside of a <title>
it breaks.
from prettier-plugin-erb.
This issue is still present for all tag types present in this array.
https://github.com/adamzapasnik/prettier-html-templates/blob/master/lib/tokenizer.js#L39
from prettier-plugin-erb.
Still an issue inside <title> tags for these deps
{
"devDependencies": {
"@prettier/plugin-ruby": "1.5.5",
"prettier": "2.2.0",
"prettier-plugin-erb": "0.2.0"
}
}
Also for 0.3.0. But it seems to work with 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
- Ruby expressions are getting replaced with <eext> HOT 16
- Handle 2.3 prettier changes HOT 6
- 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.