Skip to content

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

Closed
@maksnester

Description

@maksnester

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>

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions