Skip to content

vue/multiline-html-element-content-newline ​

require a line break before and after the contents of a multiline element

  • ⚙️ This rule is included in the following preset configs:
    • *.configs["flat/strongly-recommended"]
    • *.configs["flat/vue2-strongly-recommended"]
    • *.configs["flat/recommended"]
    • *.configs["flat/vue2-recommended"]
    • "plugin:vue/strongly-recommended"
    • "plugin:vue/vue2-strongly-recommended"
    • "plugin:vue/recommended"
    • "plugin:vue/vue2-recommended"
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details ​

This rule enforces a line break before and after the contents of a multiline element.

Now loading...

🔧 Options ​

js
{
    "vue/multiline-html-element-content-newline": ["error", {
        "ignoreWhenEmpty": true,
        "ignores": ["pre", "textarea", "router-link", "nuxt-link", ...INLINE_ELEMENTS],
        "allowEmptyLines": false,
        "ignoreComments": false
    }]
}
  • ignoreWhenEmpty ... disables reporting when element has no content. default true
  • ignores ... the configuration for element names to ignore line breaks style. default ["pre", "textarea", "router-link", "nuxt-link", ...INLINE_ELEMENTS].
  • allowEmptyLines ... if true, it allows empty lines around content. If you want to disallow multiple empty lines, use no-multiple-empty-lines in combination.
    default false
  • ignoreComments ... if true, HTML comments on the same line as the opening or closing tag are not treated as content, so the line breaks are checked against the content after or before them.
    default false

INFO

All inline non void elements can be found here.

"ignores": ["VueComponent", "pre", "textarea"] ​

Now loading...

"allowEmptyLines": true ​

Now loading...

"ignoreComments": true ​

Now loading...

🚀 Version ​

This rule was introduced in eslint-plugin-vue v5.0.0

🔍 Implementation ​