eslint-plugin-vue icon indicating copy to clipboard operation
eslint-plugin-vue copied to clipboard

Push each HTML element onto a new line

Open rezelute opened this issue 4 years ago • 2 comments

Im sorry to be asking what might be an obvious question but is there a way to force each HTML element onto a new line? The rules i come across seem to be related to content as opposed to the whole element. For ex:

// BAD
<div>helloworld</div><div>Hello world 2</div>

// ALSO BAD
<div>helloworld</div><div>
Hello world 2
</div>

// GOOD
<div>helloworld</div>
<div>Hello world 2</div>

Prettier does this however I am trying to ditch prettier because of how much it conflicts with eslint vue rules and I would prefer more control over the linting.

I have tried "vue/singleline-html-element-content-newline" but that turns this:

<h1>{{ msg }}</h1> <div>test</div>
// BECOMES THIS
<h1>
    {{ msg }}
</h1> <div>
    test
</div>

I would like the div on be on a newline and i also think that attribute is more for targetting the content and not each element. I guess i am looking for something like "vue/singleline-html-element-newline" ?

rezelute avatar Dec 21 '20 18:12 rezelute

No takers on this one? Is it more complicated?

rezelute avatar Jan 14 '21 21:01 rezelute

@rezelute have you got any solution? I'm thinking of creating a PR for this rule

oriel351 avatar Jan 17 '23 14:01 oriel351