Skip to content

Latest commit

 

History

History
82 lines (59 loc) · 1.74 KB

no-restricted-html-elements.md

File metadata and controls

82 lines (59 loc) · 1.74 KB

vue/no-restricted-html-elements

Disallow specific html elements

📖 Rule Details

This rule allows you to specify html elements that you don't want to use in your application.

<!-- ✓ GOOD -->
<p></p>
<input />
<br />

<!-- ✗ BAD -->
<button></button>
<marquee></marquee>

🔧 Options

This rule takes a list of strings, where each string is an html element name to be restricted:

{
  "vue/no-restricted-html-elements": ["error", "button", "marquee"]
}
<!-- ✗ BAD -->
<button></button>
<marquee></marquee>

Alternatively, the rule also accepts objects.

{
  "vue/no-restricted-html-elements": [
    "error",
    {
      "element": "button",
      "message": "Prefer use of our custom <Button /> component"
    },
    {
      "element": "marquee",
      "message": "Do not use deprecate html tags"
    }
  ]
}

The following properties can be specified for the object.

  • element ... Specify the html element.
  • message ... Specify an optional custom message.

{ "element": "marquee" }, { "element": "button" }

<!-- ✗ BAD -->
<marquee></marquee>
<button></button>

🔍 Implementation