Appearance
vue/no-reserved-component-names
禁止组件定义中保留名称的使用
- ⚙️ 此规则包含在
"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"]中。
📖 规则详情
此规则可防止 Vue 组件与标准 HTML 元素和内置组件之间的名称冲突。
¥This rule prevents name collisions between Vue components and standard HTML elements and built-in components.
🔧选项
¥🔧 Options
json
{
"vue/no-reserved-component-names": ["error", {
"disallowVueBuiltInComponents": false,
"disallowVue3BuiltInComponents": false,
"htmlElementCaseSensitive": false,
}]
}disallowVueBuiltInComponents(boolean) ...如果是true,则不允许使用 Vue.js 2.x 内置组件名称。默认值为false。¥
disallowVueBuiltInComponents(boolean) ... Iftrue, disallow Vue.js 2.x built-in component names. Default isfalse.disallowVue3BuiltInComponents(boolean) ...如果是true,则不允许使用 Vue.js 3.x 内置组件名称。默认值为false。¥
disallowVue3BuiltInComponents(boolean) ... Iftrue, disallow Vue.js 3.x built-in component names. Default isfalse.htmlElementCaseSensitive(boolean) ...如果是true,则组件名称必须与 HTML 元素的大小写完全匹配,才会被视为冲突。默认值为false(即不区分大小写的比较)。¥
htmlElementCaseSensitive(boolean) ... Iftrue, component names must exactly match the case of an HTML element to be considered conflicting. Default isfalse(i.e. case-insensitve comparison).
"disallowVueBuiltInComponents": true
"disallowVue3BuiltInComponents": true
"htmlElementCaseSensitive": true
👫相关规则
¥👫 Related Rules
📚扩展阅读
¥📚 Further Reading
🚀版本
¥🚀 Version
此规则在 eslint-plugin-vue v6.1.0 中引入
¥This rule was introduced in eslint-plugin-vue v6.1.0
🔍代码实现
¥🔍 Implementation