Skip to content

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.

Now loading...

🔧选项

¥🔧 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. default true

  • 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 ... 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

信息

所有内联非 void 元素都可以在 此处 中找到。

¥All inline non void elements can be found here.

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

Now loading...

"allowEmptyLines": true

Now loading...

📚扩展阅读

¥📚 Further Reading

🚀版本

¥🚀 Version

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

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

🔍代码实现

¥🔍 Implementation

eslint-plugin-vue v10.0 中文网 - 粤ICP备13048890号