]> git.proxmox.com Git - pve-eslint.git/blame - eslint/docs/rules/no-dupe-keys.md
bump version to 8.4.0-3
[pve-eslint.git] / eslint / docs / rules / no-dupe-keys.md
CommitLineData
eb39fafa
DC
1# disallow duplicate keys in object literals (no-dupe-keys)
2
3Multiple properties with the same key in object literals can cause unexpected behavior in your application.
4
5```js
6var foo = {
7 bar: "baz",
8 bar: "qux"
9};
10```
11
12## Rule Details
13
14This rule disallows duplicate keys in object literals.
15
16Examples of **incorrect** code for this rule:
17
18```js
19/*eslint no-dupe-keys: "error"*/
20
21var foo = {
22 bar: "baz",
23 bar: "qux"
24};
25
26var foo = {
27 "bar": "baz",
28 bar: "qux"
29};
30
31var foo = {
32 0x1: "baz",
33 1: "qux"
34};
35```
36
37Examples of **correct** code for this rule:
38
39```js
40/*eslint no-dupe-keys: "error"*/
41
42var foo = {
43 bar: "baz",
44 quxx: "qux"
45};
46```