Appearance
vue/padding-line-between-tags
要求或禁止模板中兄弟标签之间的换行符
- 🔧 command line 上的
--fix选项可以自动修复此规则报告的一些问题。
📖 规则详情
此规则要求或禁止在同级 HTML 标记之间有换行符。
¥This rule requires or disallows newlines between sibling HTML tags.
Now loading...
🔧选项
¥🔧 Options
json
{
"vue/padding-line-between-tags": ["error", [
{ "blankLine": "always", "prev": "*", "next": "*" }
]]
}此规则默认要求每个同级 HTML 标记之间有空行。
¥This rule requires blank lines between each sibling HTML tag by default.
配置是一个具有 3 个属性的对象;blankLine、prev 和 next。例如,{ blankLine: "always", prev: "br", next: "div" } 表示“br 标签和 div 标签之间需要一个或多个空行”。你可以提供任意数量的配置。如果标签对匹配多个配置,则将使用最后匹配的配置。
¥A configuration is an object which has 3 properties; blankLine, prev and next. For example, { blankLine: "always", prev: "br", next: "div" } means “one or more blank lines are required between a br tag and a div tag.” You can supply any number of configurations. If a tag pair matches multiple configurations, the last matched configuration will be used.
blankLine是以下之一:¥
blankLineis one of the following:always需要一个或多个空行。¥
alwaysrequires one or more blank lines.never不允许空行。¥
neverdisallows blank lines.consistent根据第一个同级元素要求或不允许空行。¥
consistentrequires or disallows a blank line based on the first sibling element.
prev任何不带括号的标签名称。¥
prevany tag name without brackets.next任何不带括号的标签名称。¥
nextany tag name without brackets.
禁止所有标签之间有空行
¥Disallow blank lines between all tags
{ blankLine: 'never', prev: '*', next: '*' }
Now loading...
要求在 <br> 之后换行符
¥Require newlines after <br>
{ blankLine: 'always', prev: 'br', next: '*' }
Now loading...
要求在 <br> 和 <img> 之间换行符
¥Require newlines between <br> and <img>
{ blankLine: 'always', prev: 'br', next: 'img' }
Now loading...
要求一致的换行符
¥Require consistent newlines
{ blankLine: 'consistent', prev: '*', next: '*' }
Now loading...
🚀版本
¥🚀 Version
此规则是在 eslint-plugin-vue v9.5.0 中引入的
¥This rule was introduced in eslint-plugin-vue v9.5.0
🔍代码实现
¥🔍 Implementation