跳至内容

vue/no-restricted-component-names

禁止使用特定的组件名称

  • 💡 此规则报告的一些问题可以通过编辑器 建议 手动修复。

📖 规则详情

此规则允许您指定您不想在应用程序中使用的组件名称。

正在加载...
正在加载...

🔧 选项

此规则接受一个字符串列表,其中每个字符串都是要限制的组件名称或模式

json
{
  "vue/no-restricted-component-names": ["error", "foo", "/^Disallow/"]
}

或者,您可以指定一个包含 name 属性和可选 messagesuggest 属性的对象

json
{
  "vue/no-restricted-component-names": [
    "error",
    {
      "name": "Disallow",
      "message": "Please do not use `Disallow` as a component name",
      "suggest": "allow"
    },
    {
      "name": "/^custom/",
      "message": "Please do not use component names starting with 'custom'"
    }
  ]
}
正在加载...

🚀 版本

此规则是在 eslint-plugin-vue v9.15.0 中引入的

🔍 实现