no-dupe-args
注意: 此规则是
recommended
规则集的一部分。在
deno.json
中启用完整规则集:{ "lint": { "rules": { "tags": ["recommended"] } } }
使用 Deno CLI 启用完整规则集:
deno lint --rules-tags=recommended
禁止在函数签名中多次使用相同的参数名称。
如果你在函数中提供了多个相同名称的参数,最后一个实例将会覆盖前面的实例。这很可能是一个无意的拼写错误。
无效示例:
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);
}