跳至内容

vue/multiline-html-element-content-newline

要求在多行元素的内容前后添加换行符

  • ⚙️ 此规则包含在所有 "plugin:vue/vue3-strongly-recommended"*.configs["flat/strongly-recommended"]"plugin:vue/strongly-recommended"*.configs["flat/vue2-strongly-recommended"]"plugin:vue/vue3-recommended"*.configs["flat/recommended"]"plugin:vue/recommended"*.configs["flat/vue2-recommended"] 中。
  • 🔧 命令行 上的 --fix 选项可以自动修复此规则报告的一些问题。

📖 规则详细信息

此规则强制在多行元素的内容前后添加换行符。

正在加载...

🔧 选项

js
{
    "vue/multiline-html-element-content-newline": ["error", {
        "ignoreWhenEmpty": true,
        "ignores": ["pre", "textarea", ...INLINE_ELEMENTS],
        "allowEmptyLines": false
    }]
}
  • ignoreWhenEmpty ... 当元素没有内容时禁用报告。默认值 true
  • ignores ... 要忽略换行符样式的元素名称的配置。默认值 ["pre", "textarea", ...INLINE_ELEMENTS]
  • allowEmptyLines ... 如果为 true,则允许在内容周围添加空行。如果您想禁止多个空行,请结合使用 no-multiple-empty-lines
    默认值 false

信息

所有内联非空元素都可以找到 这里

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

正在加载...

"allowEmptyLines": true

正在加载...

📚 进一步阅读

🚀 版本

此规则是在 eslint-plugin-vue v5.0.0 中引入的

🔍 实现