Skip to content

Latest commit

 

History

History
98 lines (77 loc) · 2.75 KB

html-closing-bracket-spacing.md

File metadata and controls

98 lines (77 loc) · 2.75 KB
pageClass sidebarDepth title description since
rule-details
0
vue/html-closing-bracket-spacing
require or disallow a space before tag's closing brackets
v4.1.0

vue/html-closing-bracket-spacing

require or disallow a space before tag's closing brackets

  • ⚙️ This rule is included in all of "plugin:vue/vue3-strongly-recommended", "plugin:vue/strongly-recommended", "plugin:vue/vue3-recommended" and "plugin:vue/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 consistent spacing style before closing brackets > of tags.

<template>
  <!-- ✓ GOOD -->
  <div>
  <div foo>
  <div foo="bar">
  </div>
  <div />
  <div foo />
  <div foo="bar" />

  <!-- ✗ BAD -->
  <div >
  <div foo >
  <div foo="bar" >
  </div >
  <div/>
  <div foo/>
  <div foo="bar"/>
</template>

🔧 Options

{
  "vue/html-closing-bracket-spacing": ["error", {
    "startTag": "always" | "never",
    "endTag": "always" | "never",
    "selfClosingTag": "always" | "never"
  }]
}
  • startTag ("always" | "never") ... Setting for the > of start tags (e.g. <div>). Default is "never".
    • "always" ... requires one or more spaces.
    • "never" ... disallows spaces.
  • endTag ("always" | "never") ... Setting for the > of end tags (e.g. </div>). Default is "never".
    • "always" ... requires one or more spaces.
    • "never" ... disallows spaces.
  • selfClosingTag ("always" | "never") ... Setting for the /> of self-closing tags (e.g. <div/>). Default is "always".
    • "always" ... requires one or more spaces.
    • "never" ... disallows spaces.

"startTag": "always", "endTag": "always", "selfClosingTag": "always"

<template>
  <!-- ✓ GOOD -->
  <div >
  <div foo >
  <div foo="bar" >
  </div >
  <div />
  <div foo />
  <div foo="bar" />
</template>

👫 Related Rules

🚀 Version

This rule was introduced in eslint-plugin-vue v4.1.0

🔍 Implementation