vue/singleline-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/singleline-html-element-content-newline": ["error", {
"ignoreWhenNoAttributes": true,
"ignoreWhenEmpty": true,
"ignores": ["pre", "textarea", ...INLINE_ELEMENTS],
"externalIgnores": []
}]
}
ignoreWhenNoAttributes
... 允许在一行中包含内容,前提是给定元素没有属性。默认值为true
ignoreWhenEmpty
... 在元素没有内容时禁用报告。默认值为true
ignores
... 用于忽略换行符样式的元素名称的配置。默认值为["pre", "textarea", ...INLINE_ELEMENTS]
externalIgnores
... 用于忽略换行符样式的外部元素名称的配置,它允许避免覆盖ignores
的默认值。默认值为[]
信息
所有内联非空元素都可以在 这里 找到。
"ignoreWhenNoAttributes": true
"ignoreWhenNoAttributes": false
🚀 版本
此规则是在 eslint-plugin-vue v5.0.0 中引入的