Skip to content

vue/first-attribute-linebreak

强制第一个属性的位置

  • ⚙️ 此规则包含在 "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 aims to enforce a consistent location for the first attribute.

Now loading...

🔧选项

¥🔧 Options

json
{
  "vue/first-attribute-linebreak": ["error", {
    "singleline": "ignore",
    "multiline": "below"
  }]
}
  • singleline ...当属性在一行上时,第一个属性的位置。默认值为 "ignore"

    ¥singleline ... The location of the first attribute when the attributes on single line. Default is "ignore".

    • "below" ...第一个属性前需要换行符。

      ¥"below" ... Requires a newline before the first attribute.

    • "beside" ...不允许在第一个属性前换行。

      ¥"beside" ... Disallows a newline before the first attribute.

    • "ignore" ...忽略属性检查。

      ¥"ignore" ... Ignores attribute checking.

  • multiline ...当属性跨越多行时,第一个属性的位置。默认值为 "below"

    ¥multiline ... The location of the first attribute when the attributes span multiple lines. Default is "below".

    • "below" ...第一个属性前需要换行符。

      ¥"below" ... Requires a newline before the first attribute.

    • "beside" ...不允许在第一个属性前换行。

      ¥"beside" ... Disallows a newline before the first attribute.

    • "ignore" ...忽略属性检查。

      ¥"ignore" ... Ignores attribute checking.

"singleline": "beside"

Now loading...

"singleline": "below"

Now loading...

"multiline": "beside"

Now loading...

"multiline": "below"

Now loading...

👫相关规则

¥👫 Related Rules

📚扩展阅读

¥📚 Further Reading

🚀版本

¥🚀 Version

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

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

🔍代码实现

¥🔍 Implementation

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