跳转到内容

noDuplicateParameters

此内容尚不支持你的语言。

Diagnostic Category: lint/suspicious/noDuplicateParameters

Since: v1.0.0

Sources:

Disallow duplicate function parameter name.

If more than one parameter has the same name in a function definition, the last occurrence overrides the preceding occurrences. A duplicated name might be a typing error.

var f = function(a, b, b) {}
code-block.js:1:24 lint/suspicious/noDuplicateParameters ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Duplicate parameter name.

> 1 │ var f = function(a, b, b) {}
^
2 │

The parameter overrides a preceding parameter by using the same name.

function b(a, b, b) {}
code-block.js:1:18 lint/suspicious/noDuplicateParameters ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Duplicate parameter name.

> 1 │ function b(a, b, b) {}
^
2 │

The parameter overrides a preceding parameter by using the same name.

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]]) {}