noDuplicateParameters
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/suspicious/noDuplicateParameters¥Diagnostic Category:
lint/suspicious/noDuplicateParameters -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
no-dupe-args相同¥Same as
no-dupe-args
-
¥How to configure
{ "linter": { "rules": { "suspicious": { "noDuplicateParameters": "error" } } }}¥Description
禁止重复的函数参数名称。
¥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.
¥Examples
¥Invalid
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.
¥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]]) {}¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号