Skip to content
On this page

vue/singleline-html-element-content-newline

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

  • ⚙️ This rule is included in all of "plugin:vue/vue3-strongly-recommended", "plugin:vue/strongly-recommended", "plugin:vue/vue3-recommended" and "plugin:vue/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 singleline element.

Now loading...

🔧 Options

js
{
  "vue/singleline-html-element-content-newline": ["error", {
    "ignoreWhenNoAttributes": true,
    "ignoreWhenEmpty": true,
    "ignores": ["pre", "textarea", ...INLINE_ELEMENTS]
  }]
}
  • ignoreWhenNoAttributes ... allows having contents in one line, when given element has no attributes. default true
  • ignoreWhenEmpty ... disables reporting when element has no content. default true
  • ignores ... the configuration for element names to ignore line breaks style. default ["pre", "textarea", ...INLINE_ELEMENTS].

INFO

All inline non void elements can be found here.

"ignoreWhenNoAttributes": true

Now loading...

"ignoreWhenNoAttributes": false

Now loading...

🚀 Version

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

🔍 Implementation