JS.VUE.VALID.V.MEMO

Invalid `v-memo` directive

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

Rule Details

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

  • The directive has that argument. E.g. <div v-memo:aaa></div>
  • The directive has that modifier. E.g. <div v-memo.bbb></div>
  • The directive does not have that attribute value. E.g. <div v-memo></div>
  • The attribute value of the directive is definitely not array. E.g. <div v-memo="{x}"></div>
  • The directive was used inside v-for. E.g. <div v-for="i in items"><div v-memo="[i]" /></div>

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

Copy
<template>
  <!-- GOOD -->
  <div v-memo="[x]"/>

  <!-- BAD -->
  <div v-memo/>
  <div v-memo:aaa="[x]"/>
  <div v-memo.bbb="[x]"/>
  <div v-memo="{x}"/>
  <div v-for="i in items">
    <div v-memo="[i]" />
  </div>
</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-memo (https://v3.vuejs.org/api/directives.html#v-memo)

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/