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

Rule proposal: newline between same level html elements

Open kailniris opened this issue 6 years ago • 1 comments
trafficstars

Please describe what the rule should do:

Enforce newline between same level HTML elements.

What category should the rule belong to?

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

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

<template>
  <div>content</div>

  <CustomElement />

  <div>
    <div>content</div>

    <CustomElement />
  </div>   
</template>

Additional context

I think this really helps code readability. Maybe for some reasons this can be a bad practice. Ether way there shell be a rule to enforce or prevents this.

kailniris avatar Dec 29 '18 15:12 kailniris

Hi @kailniris Thank you for this proposition. However this will never be white or black and in this case I think we should just follow common sense. Using one or the other approach exclusively might produce actually worse code. I'll leave this open for now, as I would love to see what others might think about it. But nevertheless it would most likely never go to any category, but remain uncategorized instead.

michalsnik avatar Dec 31 '18 00:12 michalsnik

This should now be possible with the vue/padding-line-between-tags rule (added in #1966).

FloEdelmann avatar May 16 '23 15:05 FloEdelmann