Appearance
vue/no-restricted-component-names
禁止特定组件名称
- 💡 此规则报告的某些问题可由编辑器 suggestions 手动修复。
📖 规则详情
此规则允许你指定你不想在应用中使用的组件名称。
¥This rule allows you to specify component names that you don't want to use in your application.
🔧选项
¥🔧 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
属性和可选 message
和 suggest
属性的对象:
¥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'"
}
]
}
👫相关规则
¥👫 Related Rules
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v9.15.0 中引入
¥This rule was introduced in eslint-plugin-vue v9.15.0
🔍代码实现
¥🔍 Implementation