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.

If your codebase relies on non-standard behavior that involves duplicate argument names (which is highly discouraged), you might choose to disable this rule. For example, if you target a legacy runtime with non-standard JavaScript semantics, standard practices may not apply to you.

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