Breaking up HTML tags in JSX upon save
See original GitHub issueHey guys, I’ve been using prettier for about 6 months now and never had an issue. but I recently updated VSCode and I ran into this problem today with it breaking out my HTML tags in my JSX and spacing it all wildly. Example follows: Before save:
return (
<div className="input-group mb-3">
<div className="input-group-prepend">
<span className="input-group-text">
<i className={icon} />
</span>
</div>
<input
className={classnames("form-control form-control-lg", {
"is-invalid": error
})}
placeholder={placeholder}
name={name}
value={value}
onChange={onChange}
/>
{error && <div className="invalid-feedback">{error}</div>}
</div>
);
};
After save
return ( <
div className = "input-group mb-3" >
<
div className = "input-group-prepend" >
<
span className = "input-group-text" >
<
i className = {
icon
}
/> <
/span> <
/div> <
input className = {
classnames("form-control form-control-lg", {
"is-invalid": error
})
}
placeholder = {
placeholder
}
name = {
name
}
value = {
value
}
onChange = {
onChange
}
/> {
error && < div className = "invalid-feedback" > {
error
} < /div>} <
/div>
);
};
I can provide additional info if needed. Such as my settings, etc.
UPDATE 6/4/18: Resolved by disabling Beautify, which was causing issues with Prettier.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:64
- Comments:28 (1 by maintainers)
Top Results From Across the Web
VS Code - breaking up HTML tags in JSX on save - Dirask
VS Code - breaking up HTML tags in JSX on save · 1. Go to File -> Preferences -> Settings, · 2. Search...
Read more >VS Code beautify break tags in react html - Stack Overflow
Save this question. Show activity on this post. Question is how can i change beautify settings to not transfer tags to a new...
Read more >Introducing JSX - React
This funny tag syntax is neither a string nor HTML. It is called JSX, and it is a syntax extension to JavaScript. We...
Read more >HTML Programming with Visual Studio Code
Tag elements are automatically closed when > of the opening tag is typed. HTML Close1. The matching closing tag is inserted when /...
Read more >HTML pre tag - W3Schools
The <pre> tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font, and the text preserves both spaces...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jtbandes Thank you so much 👍 FYI: it conflicts with beautify so we add:
and it fixed =))
Oh, thank the heavens, the linked issue at jsbeautify solved it for me. Disabled the Beautify plugin on my vscode and all is well.