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”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.
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.