简中文档

no-dupe-class-members

NOTE: this rule is part of the recommended rule set.
Enable full set in deno.json:
{
  "lint": {
    "rules": {
      "tags": ["recommended"]
    }
  }
}
Enable full set using the Deno CLI:
deno lint --rules-tags=recommended
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-class-members"],
      "exclude": ["no-dupe-class-members"]
    }
  }
}

不允许在类中一个成员函数名使用多次。

在一个类中声明同名的函数两次会导致之前的声明被覆盖,从而造成意想不到的行为。

无效:

class Foo {
  bar() {}
  bar() {}
}

有效:

class Foo {
  bar() {}
  fizz() {}
}

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

编辑此页面
隐私政策