Skip to content

Latest commit

 

History

History
67 lines (46 loc) · 1.58 KB

shorthand-attribute.md

File metadata and controls

67 lines (46 loc) · 1.58 KB
pageClass sidebarDepth title description since
rule-details
0
svelte/shorthand-attribute
enforce use of shorthand syntax in attribute
v0.5.0

svelte/shorthand-attribute

enforce use of shorthand syntax in attribute

  • 🔧 The --fix option on the command line can automatically fix some of the problems reported by this rule.

📖 Rule Details

This rule enforces the use of the shorthand syntax in attribute.

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

<!-- ✓ GOOD -->
<button {disabled}>...</button>

<!-- ✗ BAD -->
<button disabled={disabled}>...</button>

🔧 Options

{
  "svelte/shorthand-attribute": [
    "error",
    {
      "prefer": "always" // "never"
    }
  ]
}
  • prefer
    • "always" ... Expects that the shorthand will be used whenever possible. This is default.
    • "never" ... Ensures that no shorthand is used in any attribute.

👫 Related Rules

🚀 Version

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

🔍 Implementation