Skip to content

vue/no-unused-vars

禁止未使用的 v-for 指令或范围属性变量定义

  • ⚙️ 此规则包含在 "plugin:vue/essential"*.configs["flat/essential"]"plugin:vue/vue2-essential"*.configs["flat/vue2-essential"]"plugin:vue/strongly-recommended"*.configs["flat/strongly-recommended"]"plugin:vue/vue2-strongly-recommended"*.configs["flat/vue2-strongly-recommended"]"plugin:vue/recommended"*.configs["flat/recommended"]"plugin:vue/vue2-recommended"*.configs["flat/vue2-recommended"] 中。
  • 💡此规则报告的某些问题可以通过编辑器 suggestions 手动修复。

    ¥💡 Some problems reported by this rule are manually fixable by editor suggestions.

📖 规则详情

此规则报告 v-for 指令或范围属性的变量定义(如果未使用)。

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

Now loading...

🔧选项

¥🔧 Options

json
{
    "vue/no-unused-vars": ["error", {
        "ignorePattern": "^_"
    }]
}
  • ignorePattern ...当你的 v-for 指令或范围属性的定义与你的 ignorePattern 正则表达式匹配时禁用报告。默认 null,不会忽略任何内容

    ¥ignorePattern ... disables reporting when your definitions of v-for directives or scope attributes match your ignorePattern Regular expression. default null, will ignore nothing

🚀建议

¥🚀 Suggestion

  • 当你的 ignorePattern 设置为 ^_ 时,我们可以提供一个建议,在你的变量中添加前缀 _,这样就不会再出现 eslint 错误

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

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v3.14.0 中引入

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

🔍代码实现

¥🔍 Implementation

eslint-plugin-vue v10.0 中文网 - 粤ICP备13048890号