Appearance
vue/multiline-html-element-content-newline
要求多行元素内容前后有换行符
- ⚙️ 此规则包含在
"plugin:vue/strongly-recommended"
、*.configs["flat/strongly-recommended"]
、"plugin:vue/vue2-strongly-recommended"
、*.configs["flat/vue2-strongly-recommended"]
、"plugin:vue/recommended"
、*.configs["flat/recommended"]
、"plugin:vue/vue2-recommended"
和*.configs["flat/vue2-recommended"]
中。
🔧命令行 上的
--fix
选项可以自动修复此规则报告的一些问题。¥🔧 The
--fix
option on the command line can automatically fix some of the problems reported by this rule.
📖 规则详情
此规则强制在多行元素的内容之前和之后换行。
¥This rule enforces a line break before and after the contents of a multiline element.
🔧选项
¥🔧 Options
js
{
"vue/multiline-html-element-content-newline": ["error", {
"ignoreWhenEmpty": true,
"ignores": ["pre", "textarea", ...INLINE_ELEMENTS],
"allowEmptyLines": false
}]
}
ignoreWhenEmpty
...当元素没有内容时禁用报告。默认true
¥
ignoreWhenEmpty
... disables reporting when element has no content. defaulttrue
ignores
...元素名称忽略换行符样式的配置。默认["pre", "textarea", ...INLINE_ELEMENTS]
。¥
ignores
... the configuration for element names to ignore line breaks style. default["pre", "textarea", ...INLINE_ELEMENTS]
.allowEmptyLines
...如果是true
,则允许内容周围有空行。如果你想禁止多个空行,请结合使用 no-multiple-empty-lines。默认false
¥
allowEmptyLines
... iftrue
, it allows empty lines around content. If you want to disallow multiple empty lines, use no-multiple-empty-lines in combination.\ defaultfalse
"ignores": ["VueComponent", "pre", "textarea"]
"allowEmptyLines": true
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v5.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v5.0.0
🔍代码实现
¥🔍 Implementation