no-dupe-keys
NOTE: this rule is part of the
recommended rule set.Enable full set in
deno.json:{
"lint": {
"tags": ["recommended"]
}
}Enable full set using the Deno CLI:
deno lint --tags=recommended
Disallows duplicate keys in object literals.
Setting the same key multiple times in an object literal will override other assignments to that key and can cause unexpected behaviour.
Invalid:
const foo = {
bar: "baz",
bar: "qux",
};
const foo = {
"bar": "baz",
bar: "qux",
};
const foo = {
0x1: "baz",
1: "qux",
};
Valid:
const foo = {
bar: "baz",
quxx: "qux",
};