添加规则时 Eslint 错误 @typescript-eslint/interface-name-prefix

Wil*_*ior 23 node.js typescript eslint

当我添加规则时,

"@typescript-eslint/interface-name-prefix": [ "error", { "prefixWithI": "always" }]
Run Code Online (Sandbox Code Playgroud)

给出以下错误信息:

未找到规则“@typescript-eslint/interface-name-prefix”的定义。eslint(@typescript-eslint/interface-name-prefix)

Tel*_*per 63

@typescript-eslint/interface-name-prefix正如您在此处看到的,该规则已被删除。

您可以[ "error", { "prefixWithI": "always" }]通过以下方式实现相同的效果:

{
  "@typescript-eslint/naming-convention": [
    "error",
    {
      "selector": "interface",
      "format": ["PascalCase"],
      "custom": {
        "regex": "^I[A-Z]",
        "match": true
      }
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

  • 我刚刚更新了我的库并遇到了同样的错误 - 感谢您的回答:) (2认同)