简中文档

no-dupe-args

NOTE: this rule is part of the 推荐 rule set.
Enable full set in deno.json:
{
  "lint": {
    "rules": {
      "tags": ["推荐"]
    }
  }
}
Enable full set using the Deno CLI:
deno lint --rules-tags=推荐
This rule can be explictly included to or excluded from the rules present in the current tag by adding it to the include or exclude array in deno.json:
{
  "lint": {
    "rules": {
      "include": ["no-dupe-args"],
      "exclude": ["no-dupe-args"]
    }
  }
}

不允许在函数签名中多次使用相同的参数名称。

如果你向一个函数提供多个相同名称的参数,最后一个实例将会覆盖前面的实例。这很可能是一个无意的拼写错误。

无效:

function withDupes(a, b, a) {
  console.log("我是第二个a的值:", a);
}

有效:

function withoutDupes(a, b, c) {
  console.log("我是第一个(也是唯一的)a的值:", a);
}

你找到了你需要的东西吗?

编辑此页面
隐私政策