Skip to content

vue/first-attribute-linebreak

enforce the location of first attribute

  • ⚙️ This rule is included in all of "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" and *.configs["flat/vue2-recommended"].
  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

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 ... The location of the first attribute when the attributes on single line. Default is "ignore".
    • "below" ... Requires a newline before the first attribute.
    • "beside" ... Disallows a newline before the first attribute.
    • "ignore" ... Ignores attribute checking.
  • multiline ... The location of the first attribute when the attributes span multiple lines. Default is "below".
    • "below" ... Requires a newline before the first attribute.
    • "beside" ... Disallows a newline before the first attribute.
    • "ignore" ... Ignores attribute checking.

"singleline": "beside"

Now loading...

"singleline": "below"

Now loading...

"multiline": "beside"

Now loading...

"multiline": "below"

Now loading...

📚 Further Reading

🚀 Version

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

🔍 Implementation