I use "eslint-plugin-vue"
I would like to use the rule "vue/singleline-html-element-content-newline" in my projects but it works inconvenient for me All the more because this rule is recommended:
This rule is included in all of "plugin:vue/vue3-strongly-recommended", "plugin:vue/strongly-recommended", "plugin:vue/vue3-recommended" and "plugin:vue/recommended". So, my problem is using text nodes without attributes:
<div attrs>
<span attrs>Text<span>
</div>
that code is better for me than
<div attrs>
<span attrs>
Text
<span>
</div>
because in the second case the text node is hanging in the air and it generates redundant code: \n\t\tText\n\t
- I know about the option "ignoreWhenNoAttributes" but it works only when no attributes.
- I can add all inline elements to the options list "ignores", but in this case, I have to add all my custom inline components. But eslint config creates for several projects.
- Yes, I can add custom components into the config for the particular project. But this becomes inconsistent.
- One more solution: wrap a text node into
<span>
element without attributes:
<div attrs>
<my-component attrs>
<span>Text<span>
<span>
</div>
As I see it would be better to ignore the rule for text nodes.
Is there any other approach for text nodes?