eslint/no-dupe-keys Correctness
What it does
Disallow duplicate keys in object literals
Why is this bad?
Multiple properties with the same key in object literals can cause unexpected behavior in your application.
It is safe to disable this rule when using TypeScript because TypeScript's compiler enforces this check.
Example
Examples of incorrect code for this rule:
js
var foo = {
bar: "baz",
bar: "qux",
};
var foo = {
bar: "baz",
bar: "qux",
};
var foo = {
0x1: "baz",
1: "qux",
};
Examples of correct code for this rule:
js
var foo = {
bar: "baz",
qux: "qux",
};
How to use
To enable this rule in the CLI or using the config file, you can use:
bash
oxlint --deny no-dupe-keys
json
{
"rules": {
"no-dupe-keys": "error"
}
}