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

Ignore HTML comments in `vue/multiline-html-element-content-newline`

Open dsl101 opened this issue 1 year ago • 0 comments

What rule do you want to change? vue/multiline-html-element-content-newline

Does this change cause the rule to produce more or fewer warnings? Fewer if new option set

How will the change be implemented? (New option, new default behavior, etc.)? New option, or extension to the ignores option. Either a boolean option, default false, called something like allowHTMLComments, or a token such as HTMLComments added to the list of possible ignores values. Note I'm not sure about the latter, as my understanding is that ignores list is looking for the element names before the subsequent content without newline (e.g. the <div>), where as we'd like to allow multiline for any element, providing that the subsequent element is a comment.

Please provide some example code that this change will affect: To enable this to be Good:

<div class="something">  <!-- or use class="other" -->
  <Component />
</div>

What does the rule currently do for this code? Currently, it produces the error vue/multiline-html-element-content-newline – Expected 1 line break after opening tab ('<div>'), but no line breaks found.

What will the rule do after it's changed? Produce no errors / warnings with same-line HTML comments

Additional context This is a common pattern for our JS code, and we'd like to be able to use the same kind of inline comments within the template:

const meaning = 42  // obviously

dsl101 avatar May 17 '23 09:05 dsl101