# svelte/html-closing-bracket-new-line

Require or disallow a line break before tag’s closing brackets

  • πŸ”§ The --fix option on the command line can automatically fix some of the problems reported by this rule.

# πŸ“– Rule Details

This rule enforces a line break (or no line break) before tag’s closing brackets, which can also be configured to be enforced on self-closing tags.

<script>
  /* eslint svelte/brackets-same-line: "error" */
</script>

<!-- βœ“ GOOD -->
<div></div>
<div
  multiline
>
  Children
</div>

<SelfClosing />
<SelfClosing
  multiline
/>

<!-- βœ— BAD -->

<div
></div>
<div
  multiline>
  Children
</div>

<SelfClosing
/>
<SelfClosing
  multiline/>

# πŸ”§ Options

{
  "svelte/brackets-same-line": [
    "error",
    {
      "singleline": "never", // ["never", "always"]
      "multiline": "always", // ["never", "always"]
      "selfClosingTag": {
        "singleline": "never", // ["never", "always"]
        "multiline": "always" // ["never", "always"]
      }
    }
  ]
}
  • singleline: ("never" by default) Configuration for single-line elements. It’s a single-line element if the element does not have attributes or the last attribute is on the same line as the opening bracket.
  • multiline: ("always" by default) Configuration for multi-line elements. It’s a multi-line element if the last attribute is not on the same line of the opening bracket.
  • selfClosingTag.singleline: Configuration for single-line self closing elements.
  • selfClosingTag.multiline: Configuration for multi-line self closing elements.

The selfClosing is optional, and by default it will use the same configuration as singleline and multiline, respectively.

# πŸš€ Version

This rule was introduced in eslint-plugin-svelte v2.45.0

# πŸ” Implementation