Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue/html-self-closing-bracket-newline #1794

Open
olemarius opened this issue Feb 8, 2022 · 1 comment
Open

vue/html-self-closing-bracket-newline #1794

olemarius opened this issue Feb 8, 2022 · 1 comment

Comments

@olemarius
Copy link

@olemarius olemarius commented Feb 8, 2022

Please describe what the rule should do:

I'd like to set multiline: 'always' for self-closing tags

<MyComp
    :foo="bar"
/>

And singleline: 'never'

<MyComp :foo="bar" />

And multiline: 'never' for tags with content.

<MyComp
    :foo="bar">
    Hello World
</MyComp>

What category should the rule belong to?

[x] Enforces code style (layout)
[ ] Warns about a potential error (problem)
[ ] Suggests an alternate way of doing something (suggestion)
[ ] Other (please specify:)

Provide 2-3 code examples that this rule should warn about:

// singleline: 'never'
<MyComp :foo="bar"
/>
// multiline: 'always'    
<MyComp 
  :foo="bar" />

Additional context

@ota-meshi
Copy link
Member

@ota-meshi ota-meshi commented Feb 8, 2022

Thank you for the rule proposal.
The rule you suggested should be an option for the existing rule vue/html-closing-bracket-newline. Otherwise, the rules will conflict.
https://eslint.vuejs.org/rules/html-closing-bracket-newline.html

I think it would be nice to add an option like selfClosingTag.

<!-- { "selfClosingTag": { "singleline": "never" } } -->
<!-- ✗ BAD -->
<MyComp :foo="bar"
/>
<!-- ✓ GOOD -->
<MyComp :foo="bar"/>
<!-- { "selfClosingTag": { "multiline": "always" } } -->
<!-- ✗ BAD -->
<MyComp 
  :foo="bar" />
<!-- ✓ GOOD -->
<MyComp 
  :foo="bar"
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants