Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.42 KB

no-unused-vars.md

File metadata and controls

49 lines (39 loc) · 1.42 KB
pageClass sidebarDepth title description
rule-details
0
vue/no-unused-vars
disallow unused variable definitions of v-for directives or scope attributes

vue/no-unused-vars

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

  • ⚙️ This rule is included in all of "plugin:vue/essential", "plugin:vue/strongly-recommended" and "plugin:vue/recommended".

📖 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>

🔧 Options

{
    "vue/no-unsed-vars": [{
        "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

🔍 Implementation