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.
Examples
Section titled “Examples”function calculateTotal(value, value) { return value * 2;}function process(first, second, first) { return first + second;}const handler = (data, data) => { console.log(data);};function calculateTotal(value) { return value * 2;}function process(first, second, third) { return first + second + third;}const handler = (data) => { console.log(data);};Options
Section titled “Options”This rule is not configurable.
When Not To Use It
Section titled “When Not To Use It”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.
Further Reading
Section titled “Further Reading”Equivalents in Other Linters
Section titled “Equivalents in Other Linters”- Biome:
noDuplicateParameters - Deno:
no-dupe-args - ESLint:
no-dupe-args
Made with ❤️🔥 in Boston by
Josh Goldberg and contributors.