Skip to content

duplicateArguments

Reports functions with duplicate parameter names in their signatures.

✅ This rule is included in the ts untyped preset.

In JavaScript, duplicate parameter names in function signatures can lead to unexpected behavior. In strict mode (which TypeScript uses by default), duplicate parameter names are a syntax error. Even in non-strict mode, only the last parameter with a given name is accessible, making earlier parameters with the same name unreachable.

function calculateTotal(value, value) {
return value * 2;
}
function process(first, second, first) {
return first + second;
}
const handler = (data, data) => {
console.log(data);
};

This rule is not configurable.

This rule should always be enabled, as duplicate parameter names are either a syntax error (in strict mode) or a source of confusion (in non-strict mode). Modern JavaScript and TypeScript code should never use duplicate parameter names.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.