JS.VUE.VALID.V.IS

Enforce valid 'v-is' directives

This rule checks whether every v-is directive is valid.

Rule Details

This rule reports v-is directives in the following cases:

  • The directive has that argument. E.g. <div v-is:aaa="foo"></div>
  • The directive has that modifier. E.g. <div v-is.bbb="foo"></div>
  • The directive does not have that attribute value. E.g. <div v-is></div>
  • The directive is on Vue-components. E.g. <MyComponent v-is="foo"></MyComponent>

{'vue/valid-v-is': ['error']}

Copy
<template>
  <!-- GOOD -->
  <tr v-is="'blog-post-row'"></tr>
  <tr v-is="foo"></tr>

  <!-- BAD -->
  <tr v-is:a="foo"></tr>
  <tr v-is.m="foo"></tr>
  <tr v-is></tr>
  <tr v-is=""></tr>
  <MyComponent v-is="foo" />
</template>

This rule does not check syntax errors in directives because it's checked by no-parsing-error rule.

Options

Nothing.

Further Reading

  • API - v-is (https://v3.vuejs.org/api/directives.html#v-is)
  • API - v-is (Old) (https://github.com/vuejs/docs-next/blob/008613756c3d781128d96b64a2d27f7598f8f548/src/api/directives.md#v-is)

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/