Skip to content

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.

Now loading...

🔧选项

¥🔧 Options

json
{
  "vue/no-reserved-component-names": ["error", {
    "disallowVueBuiltInComponents": false,
    "disallowVue3BuiltInComponents": false,
    "htmlElementCaseSensitive": false,
  }]
}
  • disallowVueBuiltInComponents (boolean) ...如果是 true,则不允许使用 Vue.js 2.x 内置组件名称。默认值为 false

    ¥disallowVueBuiltInComponents (boolean) ... If true, disallow Vue.js 2.x built-in component names. Default is false.

  • disallowVue3BuiltInComponents (boolean) ...如果是 true,则不允许使用 Vue.js 3.x 内置组件名称。默认值为 false

    ¥disallowVue3BuiltInComponents (boolean) ... If true, disallow Vue.js 3.x built-in component names. Default is false.

  • htmlElementCaseSensitive (boolean) ...如果是 true,则组件名称必须与 HTML 元素的大小写完全匹配,才会被视为冲突。默认值为 false(即不区分大小写的比较)。

    ¥htmlElementCaseSensitive (boolean) ... If true, component names must exactly match the case of an HTML element to be considered conflicting. Default is false (i.e. case-insensitve comparison).

"disallowVueBuiltInComponents": true

Now loading...

"disallowVue3BuiltInComponents": true

Now loading...

"htmlElementCaseSensitive": true

Now loading...
Now loading...

👫相关规则

¥👫 Related Rules

📚扩展阅读

¥📚 Further Reading

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v6.1.0 中引入

¥This rule was introduced in eslint-plugin-vue v6.1.0

🔍代码实现

¥🔍 Implementation

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