vue/no-dupe-keys Correctness
What it does
Disallow duplication of field names.
Why is this bad?
Duplicate keys in Vue component options (props, data, computed, methods, setup) can cause unexpected behavior because they may overwrite each other at runtime, and they cause name collisions in the template.
Examples
Examples of incorrect code for this rule:
vue
<script>
export default {
props: ["foo"],
computed: {
foo() {},
},
};
</script>Examples of correct code for this rule:
vue
<script>
export default {
props: ["foo"],
computed: {
bar() {},
},
};
</script>Configuration
groups
type: string[]
default: []
Additional group names to search for duplicate keys in, on top of the built-in props, computed, data, methods and setup groups.
How to use
To enable this rule using the config file or in the CLI, you can use:
json
{
"plugins": ["vue"],
"rules": {
"vue/no-dupe-keys": "error"
}
}ts
import { defineConfig } from "oxlint";
export default defineConfig({
plugins: ["vue"],
rules: {
"vue/no-dupe-keys": "error",
},
});bash
oxlint --deny vue/no-dupe-keys --vue-pluginVersion
This rule was added in vnext.
