noVueDeprecatedHtmlElementIs (HTML)
Language HTML
Summary
Section titled “Summary”- Rule available since:
v2.6.5 - Diagnostic Category:
lint/nursery/noVueDeprecatedHtmlElementIs - This rule doesn’t have a fix.
- The default severity of this rule is error.
- This rule belongs to the following domains:
- Sources:
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noVueDeprecatedHtmlElementIs": "error" } } }}Description
Section titled “Description”Disallow the is attribute on HTML elements in Vue templates.
In Vue 2, you could add is to an HTML element, such as <tr is="my-row">, to render a
component in its place. Vue 3 removed this. On an HTML, SVG, or MathML element, Vue 3
passes is to the browser as a regular attribute, so the component isn’t rendered.
To render a component in place of an HTML element, prefix the value with vue:, as in
<tr is="vue:my-row">. To choose the component while the app is running, use the
built-in <component> element, as in <component :is="current">.
This rule doesn’t report is on components, such as <MyComponent> or <component>.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<template> <div is="my-component" /></template>code-block.vue:2:8 lint/nursery/noVueDeprecatedHtmlElementIs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The is attribute is used on a built-in element.
1 │ <template>
> 2 │ <div is="my-component" />
│ ^^^^^^^^^^^^^^^^^
3 │ </template>
4 │
ℹ Vue 3 no longer renders a component in place of a built-in HTML, SVG, or MathML element with is. It passes the attribute to the browser instead.
ℹ Prefix the value with vue:, or use the <component> element to render a component.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<template> <div :is="currentComponent" /></template>code-block.vue:2:8 lint/nursery/noVueDeprecatedHtmlElementIs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ The is attribute is used on a built-in element.
1 │ <template>
> 2 │ <div :is="currentComponent" />
│ ^^^^^^^^^^^^^^^^^^^^^^
3 │ </template>
4 │
ℹ Vue 3 no longer renders a component in place of a built-in HTML, SVG, or MathML element with is. It passes the attribute to the browser instead.
ℹ Use the <component> element to choose which component to render.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
<template> <div /> <div is="vue:my-component" /> <component is="my-component" /> <component :is="currentComponent" /> <MyComponent is="my-component" /></template>References
Section titled “References”Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.