Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

159
Views
vue/singleline-html-element-content-newline for text node

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?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!