question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rule-proposal: add a new line after html-closing-bracket

See original GitHub issue

What category of rule is this? (place an “X” next to just one item)

[X] Enforces code style [ ] Warns about a potential error [ ] Suggests an alternate way of doing something

It could be a very convenient with the html-closing-bracket-newline rule usage.

Motivation:

Currently, this piece of html a fully valid when used with vue/recommended and this rule:

"vue/html-closing-bracket-newline": ["error", {
      "singleline": "never",
      "multiline": "always"
    }],

They are all different:

<li>
  <a
    href="http://router.vuejs.org/"
    target="_blank"
  >vue-router</a>
</li>
<li>
  <a
    href="http://vuex.vuejs.org/"
    target="_blank"
  >
    vuex
  </a>
</li>
<li>
  <a
    href="http://vue-loader.vuejs.org/"
    target="_blank"
  >vue-loader
  </a>
</li>

Suggestion

With suggested rule it could looks like the following:

<li>
  <a
    href="http://router.vuejs.org/"
    target="_blank"
  >
    vue-router
  </a>
</li>
<div>
  <div
    some="prop"
    another="prop"
  >
    <some-html>
      <even-more />
    </some-html>
  </div>
</li>

But If there is no children I suggest no newline.

<div>
  <div some="prop"
       another="prop"
  ></div>
</li>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
michalsnikcommented, Mar 21, 2018

I see it like this:

Settings:

"vue/html-content-newline": ["error", {
  "singleline": "ignore",
  "multiline": "always"
}],

Incorrect:

<div
  class="panel"
>content</div>  

Correct:

<div class="panel">content</div>

<div class="panel">
  content
</div>

<div
  class="panel"
>
  content
</div>

Settings:

"vue/html-content-newline": ["error", {
  "singleline": "always",
  "multiline": "never"
}],

Incorrect:

<div class="panel">panel</div>

<div
  class="panel"
>
  content
</div>  

Correct:

<div class="panel">
  content
</div>

<div
  class="panel"
>content</div>

singleline and multiline options describe range of opening tag.

0reactions
begueradjcommented, Jan 28, 2019

I am trying to get rid of those standalone and trailing >. Any option to adjust?

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue/html-closing-bracket-newline
People have their own preference about the location of closing brackets. This rule enforces a line break (or no line break) before tag's ......
Read more >
block-closing-brace-newline-after - Stylelint
The newline after this brace */. This rule allows an end-of-line comment separated from the closing brace by spaces, as long as the...
Read more >
Prettier 2.6: new singleAttributePerLine option and new ...
This release includes a new singleAttributePerLine option. This is an option to print only one attribute per line in Vue SFC templates, HTML...
Read more >
Auto-completion - Notepad++ User Manual
Notepad++ offers automatic completion of various sorts of text after you have ... caret is between the opening and closing parentheses of the...
Read more >
Airbnb JavaScript Style Guide()
4.7 Use line breaks after open and before close array brackets if an array ... You can add new properties over time or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found