Skip to content

vue/no-unused-components

禁止注册模板中未使用的组件

  • ⚙️ 此规则包含在 "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"] 中。

📖 规则详情

此规则报告模板中未使用的组件。

¥This rule reports components that haven't been used in the template.

Now loading...
Now loading...

注意

PascalCasecamelCase 名称下注册的组件可以按你喜欢的方式调用,但使用 snake_case 除外。否则,需要直接在指定的名称下调用它们。

¥Components registered under PascalCase or camelCase names have may be called however you like, except using snake_case. Otherwise, they will need to be called directly under the specified name.

🔧选项

¥🔧 Options

json
{
  "vue/no-unused-components": ["error", {
    "ignoreWhenBindingPresent": true
  }]
}
  • ignoreWhenBindingPresent ...如果在模板默认 true 中检测到绑定,则抑制所有错误

    ¥ignoreWhenBindingPresent ... suppresses all errors if binding has been detected in the template default true

ignoreWhenBindingPresent: false

Now loading...
Now loading...

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v7.0.0 中引入

¥This rule was introduced in eslint-plugin-vue v7.0.0

🔍代码实现

¥🔍 Implementation

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