JS.VUE.NO.RESTRICTED.HTML.ELEMENTS

Unwanted HTML element in application

Rule Details

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

{'vue/no-restricted-html-elements': ['error', 'marquee', 'button'] }

Copy
<template>
  <!-- GOOD -->
  <p></p>
  <input />
  <br />

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

Options

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

Copy
{
  "vue/no-restricted-html-elements": ["error", "button", "marquee"]
}

{'vue/no-restricted-html-elements': ['error', 'button', 'marquee']}

Copy
<template>
  <!-- BAD -->
  <button></button>
  <marquee></marquee>
</template>

Alternatively, the rule also accepts objects.

Copy
{
  "vue/no-restricted-html-elements": [
    "error",
    {
      "element": "button",
      "message": "Prefer use of our custom <AppButton /> component"
    },
    {
      "element": "marquee",
      "message": "Do not use deprecated 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" }

{'vue/no-restricted-html-elements': ['error', { element: 'marquee' }, { element: 'button' }]}

Copy
<template>
  <!-- BAD -->
  <marquee></marquee>
  <button></button>
</template>

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/