# vue/no-unused-vars

disallow unused variable definitions of v-for directives or scope attributes

  • ⚙️ This rule is included in all of "plugin:vue/vue3-essential", "plugin:vue/essential", "plugin:vue/vue3-strongly-recommended", "plugin:vue/strongly-recommended", "plugin:vue/vue3-recommended" and "plugin:vue/recommended".
  • 💡 Some problems reported by this rule are manually fixable by editor suggestions (opens new window).

# 📖 Rule Details

This rule report variable definitions of v-for directives or scope attributes if those are not used.

<template> <!-- ✓ GOOD --> <ol v-for="i in 5"> <li>{{ i }}</li> </ol> <!-- ✗ BAD --> <ol v-for="i in 5"> <li>item</li> </ol> </template>
Now loading...

# 🔧 Options

{
    "vue/no-unused-vars": ["error", {
        "ignorePattern": "^_"
    }]
}
  • ignorePattern ... disables reporting when your definitions of v-for directives or scope attributes match your ignorePattern Regular expression. default null, will ignore nothing

# 🚀 Suggestion

  • When your ignorePattern set to ^_, we could provide a suggestion which add a prefix_ to your variable and no more eslint error

# 🚀 Version

This rule was introduced in eslint-plugin-vue v3.14.0

# 🔍 Implementation

Last Updated: 11/16/2021, 12:44:57 AM