Skip to main content

noDupeArgs (since v0.9.0)

This rule is recommended by Rome.

Disallow duplicate function arguments name.

Examples

Invalid

var f = function(a, b, b) {}
correctness/noDupeArgs.js:1:24 lint/correctness/noDupeArgs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Duplicate argument name
  
     correctness/noDupeArgs.js:1:24
    
  1  var f = function(a, b, b) {}
                            ^
  
function b(a, b, b) {}
correctness/noDupeArgs.js:1:18 lint/correctness/noDupeArgs ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Duplicate argument name
  
     correctness/noDupeArgs.js:1:18
    
  1  function b(a, b, b) {}
                      ^
  

Valid

function i(i, b, c) {}
var j = function (j, b, c) {};
function k({ k, b }, { c, d }) {}
function l([, l]) {}
function foo([[a, b], [c, d]]) {}