deno_lint logodeno_lint

All rules/no-dupe-keys

no-dupe-keys

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",
};