[resolved] [HTML] allow corresponding option to jsxBracketSameLine
See original GitHub issueNote: Read this comment to make sure you’re up-to-speed on what this issue is and is not about: https://github.com/prettier/prettier/issues/5377#issuecomment-628213559
For React/JSX - Prettier has an option to allow tags to close on the same line as the declaration, rather then on a new line:
jsxBracketSameLine: true
:
<button
className="prettier-class"
id="prettier-id"
onClick={this.handleClick}>
Click Here
</button>
jsxBracketSameLine: false
:
<button
className="prettier-class"
id="prettier-id"
onClick={this.handleClick}
>
Click Here
</button>
With Prettier 1.15.1, at least for the Angular parser, there is no corresponding option, so all HTML is formatted like this: Input:
<my-component class="wcd-flex-1 dialog-contents wcd-scroll-vertical"
[foo]="bar">
</my-component>
Output:
<my-component
class="wcd-flex-1 dialog-contents wcd-scroll-vertical"
[foo]="bar"
>
</my-component>
It would be nice to have a flag to set it such that the output of the above would be:
<my-component
class="wcd-flex-1 dialog-contents wcd-scroll-vertical"
[foo]="bar">
</my-component>
Issue Analytics
- State:
- Created 5 years ago
- Reactions:434
- Comments:292 (68 by maintainers)
Top Results From Across the Web
Prettier 2.4: new bracketSameLine option and TypeScript 4.4 ...
This release renames the `jsxBracketSameLine` option to `bracketSameLine`, which supports HTML, Vue, and Angular in addition to JSX.
Read more >Why do I keep getting "[eslint] Delete `CR` [prettier/prettier]"?
Try setting the "endOfLine":"auto" in your .prettierrc (or .prettierrc.json) file (inside the object). Or set 'prettier/prettier': [ 'error' ...
Read more >prettier-plugin-svelte | Yarn - Package Manager
Format your HTML, CSS, and JavaScript using prettier; Format Svelte syntax, e.g. each loops, if statements, await blocks, etc.
Read more >Help prompts for different compilers
--strict Enable all strict type-checking options. --noImplicitAny Raise error on ... --baseUrl Base directory to resolve non-absolute module names.
Read more >eslint-plugin-prettierx - npm
Almost all plugins include configs to enable several of its rules. ... These are the predefined prettierx options and it is the best...
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 Hashnode Post
No results found
Top GitHub Comments
And so, it took 2 weeks. No negative reaction from maintainers (most of positive or neutral). I think it’s time for us to move on. I hope no one will be angry (including prettier maintainers).
I think consolidating of the
bracketSameLine
option is the best solution here. In fact, we don’t even create a new option. It’s just an improvement.Roadmap (should be done in one PR):
jsxBracketSameLine
(soft, only deprecation message, logic should not be changed, thejsxBracketSameLine
option only affected onjsx
).bracketSameLine
option (for HTML, JSX, Vue, Angular, usingbracketSameLine: true
setsjsxBracketSameLine
totrue
too).I ask you to refrain from unnecessary/spam/off topic/etc comments so that we do not lose this comment. You can express emotions using emoji ⭐ And yes, PR welcome.
I don’t think I’ve ever seen any markup language with the closing brackets on a separate line. I’d like to see
angleBracketSameLine
or some equivalent.