Skip to content

vue/no-dupe-keys

禁止字段名称重复

  • ⚙️ 此规则包含在 "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"] 中。

此规则可防止使用重复的键名。

¥This rule prevents using duplicate key names.

📖 规则详情

此规则可防止在组件上定义重复的 props/data/methods/等键名。即使键名在 <script> 标签本身中不冲突,它仍可能导致 <template> 中的冲突,因为 Vue 允许直接从那里访问这些键。

¥This rule prevents duplicate props/data/methods/etc. key names defined on a component. Even if a key name does not conflict in the <script> tag itself, it still may lead to a conflict in the <template> since Vue allows directly accessing these keys from there.

Now loading...

🔧选项

¥🔧 Options

json
{
  "vue/no-dupe-keys": ["error", {
    "groups": []
  }]
}
  • "groups"string[])用于搜索重复项的其他组数组。默认值为空。

    ¥"groups" (string[]) Array of additional groups to search for duplicates. Default is empty.

"groups": ["firebase"]

Now loading...

🚀版本

¥🚀 Version

此规则在 eslint-plugin-vue v3.9.0 中引入

¥This rule was introduced in eslint-plugin-vue v3.9.0

🔍代码实现

¥🔍 Implementation

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