Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

162
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda