Appearance
强制 HTML 注释中的统一换行符
--fix
此规则将强制注释的 <!-- 之后和 --> 之前的换行符一致。它还为各种文档样式提供了几个例外。
<!--
-->
¥This rule will enforce consistency of line break after the <!-- and before the --> of comment. It also provides several exceptions for various documentation styles.
¥🔧 Options
{ "vue/html-comment-content-newline": ["error", { "singleline": "always" | "never" | "ignore", "multiline": "always" | "never" | "ignore", }, { "exceptions": [] } ] }
第一个选项是具有 "singleline" 和 "multiline" 键的对象。
"singleline"
"multiline"
¥The first option is either an object with "singleline" and "multiline" keys.
singleline ...单行注释的配置。
singleline
¥singleline ... the configuration for single-line comments.
"never"(默认)...在 <!-- 之后和 --> 之前禁止换行。
"never"
¥"never" (default) ... disallow line breaks after the <!-- and before the -->.
"always" ...要求在 <!-- 之后和 --> 之前有一个换行符。
"always"
¥"always" ... require one line break after the <!-- and before the -->.
multiline ...多行注释的配置。
multiline
¥multiline ... the configuration for multiline comments.
"never" ...在 <!-- 之后和 --> 之前禁止换行。
¥"never" ... disallow line breaks after the <!-- and before the -->.
"always"(默认)...要求在 <!-- 之后和 --> 之前有一个换行符。
¥"always" (default) ... require one line break after the <!-- and before the -->.
你还可以通过指定字符串为 singleline 和 multiline 设置相同的值。
¥You can also set the same value for both singleline and multiline by specifies a string.
此规则还可以采用第二个选项,即具有以下键的对象:"exceptions"。
"exceptions"
¥This rule can also take a 2nd option, an object with the following key: "exceptions".
"exceptions" 值是一个字符串模式数组,这些模式被视为规则的例外。
¥The "exceptions" value is an array of string patterns which are considered exceptions to the rule.
"vue/html-comment-content-newline": ["error", { ... }, { "exceptions": ["*"] }]
{"singleline": "always", "multiline": "ignore"}
{"singleline": "ignore", "multiline": "always"}
"always", { "exceptions": ["*"] }
¥👫 Related Rules
vue/html-comment-indent
vue/html-comment-content-spacing
spaced-comment
¥🚀 Version
此规则在 eslint-plugin-vue v7.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.0.0
¥🔍 Implementation
规则源
¥Rule source
测试源
¥Test source
vue/html-comment-content-newline
--fix
选项可以自动修复此规则报告的一些问题。📖 规则详情
此规则将强制注释的
<!--
之后和-->
之前的换行符一致。它还为各种文档样式提供了几个例外。¥This rule will enforce consistency of line break after the
<!--
and before the-->
of comment. It also provides several exceptions for various documentation styles.🔧选项
¥🔧 Options
第一个选项是具有
"singleline"
和"multiline"
键的对象。¥The first option is either an object with
"singleline"
and"multiline"
keys.singleline
...单行注释的配置。¥
singleline
... the configuration for single-line comments."never"
(默认)...在<!--
之后和-->
之前禁止换行。¥
"never"
(default) ... disallow line breaks after the<!--
and before the-->
."always"
...要求在<!--
之后和-->
之前有一个换行符。¥
"always"
... require one line break after the<!--
and before the-->
.multiline
...多行注释的配置。¥
multiline
... the configuration for multiline comments."never"
...在<!--
之后和-->
之前禁止换行。¥
"never"
... disallow line breaks after the<!--
and before the-->
."always"
(默认)...要求在<!--
之后和-->
之前有一个换行符。¥
"always"
(default) ... require one line break after the<!--
and before the-->
.你还可以通过指定字符串为
singleline
和multiline
设置相同的值。¥You can also set the same value for both
singleline
andmultiline
by specifies a string.此规则还可以采用第二个选项,即具有以下键的对象:
"exceptions"
。¥This rule can also take a 2nd option, an object with the following key:
"exceptions"
."exceptions"
值是一个字符串模式数组,这些模式被视为规则的例外。¥The
"exceptions"
value is an array of string patterns which are considered exceptions to the rule."always"
"never"
{"singleline": "always", "multiline": "ignore"}
{"singleline": "ignore", "multiline": "always"}
"always", { "exceptions": ["*"] }
👫相关规则
¥👫 Related Rules
vue/html-comment-indent
vue/html-comment-content-spacing
spaced-comment
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v7.0.0 中引入
¥This rule was introduced in eslint-plugin-vue v7.0.0
🔍代码实现
¥🔍 Implementation
规则源
¥Rule source
测试源
¥Test source