禁止重复参数
注意:此规则是
recommended
规则集的一部分。在
deno.json
中启用完整集合{ "lint": { "rules": { "tags": ["recommended"] } } }
使用 Deno CLI 启用完整集合
deno lint --rules-tags=recommended
通过将其添加到
deno.json
中的 include
或 exclude
数组,可以将此规则显式地包含或排除在当前标签中的规则之外。{ "lint": { "rules": { "include": ["no-dupe-args"], "exclude": ["no-dupe-args"] } } }
禁止在函数签名中多次使用参数名。
如果在函数中提供多个同名参数,最后一个实例将覆盖前面一个或多个实例。这很可能是一个无意的打字错误。
无效示例
function withDupes(a, b, a) {
console.log("I'm the value of the second a:", a);
}
有效示例
function withoutDupes(a, b, c) {
console.log("I'm the value of the first (and only) a:", a);
}