Skip to content

Latest commit

 

History

History
80 lines (59 loc) · 2.14 KB

first-attribute-linebreak.md

File metadata and controls

80 lines (59 loc) · 2.14 KB
pageClass sidebarDepth title description since
rule-details
0
svelte/first-attribute-linebreak
enforce the location of first attribute
v0.6.0

svelte/first-attribute-linebreak

enforce the location of first attribute

  • 🔧 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.

<script>
  /* eslint svelte/first-attribute-linebreak: "error" */
</script>

<!-- ✓ GOOD -->
<input type="checkbox" />
<button
  type="button"
  on:click={click} />
<button type="button" on:click={click} />

<!-- ✗ BAD -->
<input
  type="checkbox" />
<button type="button"
  on:click={click} />
<button
  type="button" on:click={click} />

🔧 Options

{
  "svelte/first-attribute-linebreak": [
    "error",
    {
      "multiline": "below", // or "beside"
      "singleline": "beside" // "below"
    }
  ]
}
  • 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.
  • singleline ... The location of the first attribute when the attributes on single line. Default is "beside".
    • "below" ... Requires a newline before the first attribute.
    • "beside" ... Disallows a newline before the first attribute.

👫 Related Rules

🚀 Version

This rule was introduced in eslint-plugin-svelte v0.6.0

🔍 Implementation