Disallow duplicate keys in object literals
The "extends": "eslint:recommended"
property in a configuration file enables this rule
Multiple properties with the same key in object literals can cause unexpected behavior in your application.
var foo = {
bar: "baz",
bar: "qux"
};
This rule disallows duplicate keys in object literals.
Examples of incorrect code for this rule:
/*eslint no-dupe-keys: "error"*/
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:
/*eslint no-dupe-keys: "error"*/
var foo = {
bar: "baz",
quxx: "qux"
};
This rule was introduced in ESLint v0.0.9.
© OpenJS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/latest/rules/no-dupe-keys