Skip to content

vue/no-restricted-component-names

禁止特定组件名称

  • 💡 此规则报告的某些问题可由编辑器 suggestions 手动修复。

📖 规则详情

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

¥This rule allows you to specify component names that you don't want to use in your application.

Now loading...
Now loading...

🔧选项

¥🔧 Options

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

¥This rule takes a list of strings, where each string is a component name or pattern to be restricted:

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

或者,你可以指定具有 name 属性和可选 messagesuggest 属性的对象:

¥Alternatively, you can specify an object with a name property and an optional message and suggest property:

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'"
    }
  ]
}
Now loading...

👫相关规则

¥👫 Related Rules

🚀版本

¥🚀 Version

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

¥This rule was introduced in eslint-plugin-vue v9.15.0

🔍代码实现

¥🔍 Implementation

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