Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

160
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda