Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@putout/plugin-remove-duplicate-keys

coderaiser47.5kMIT7.0.0

🐊Putout plugin adds ability to find and remove duplicate keys

putout, putout-plugin, putout-plugin-remove, plugin, duplicate, key

readme

@putout/plugin-remove-duplicate-keys NPM version

An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in curly braces ({}).

(c) MDN

🐊Putout plugin adds ability to find and remove duplecate keys.

Install

npm i @putout/plugin-remove-duplicate-keys

Rule

{
    "rules": {
        "remove-duplicate-keys": "on"
    }
}

❌ Example of incorrect code

const a = {
    x: 'hello',
    ...z,
    x: 'world',
};

✅ Example of correct code

const a = {
    ...z,
    x: 'world',
};

SyntaxError: Duplicate parameter name not allowed in this context

(c) MDN

Argument name clash:

-const a = ({b, b, ...c}) => {};
+const a = ({b, ...c}) => {};

License

MIT