【问题标题】:Eslint erro when adding rule @typescript-eslint/interface-name-prefix添加规则 @typescript-eslint/interface-name-prefix 时出现 Eslint 错误
【发布时间】:2020-11-04 23:31:02
【问题描述】:

当我添加规则时,

"@typescript-eslint/interface-name-prefix": [ "error", { "prefixWithI": "always" }]

给出以下错误信息:

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

【问题讨论】:

    标签: node.js typescript eslint


    【解决方案1】:

    规则@typescript-eslint/interface-name-prefix 已被删除,如您所见here

    你可以通过以下方式达到[ "error", { "prefixWithI": "always" }]同样的效果:

    {
      "@typescript-eslint/naming-convention": [
        "error",
        {
          "selector": "interface",
          "format": ["PascalCase"],
          "custom": {
            "regex": "^I[A-Z]",
            "match": true
          }
        }
      ]
    }
    

    【讨论】:

    • 我刚刚更新了我的库并且遇到了同样的错误——感谢您的回答:)
    • 我用命令(yarn upgrade-interactive --latest)更新软件包后出现错误,非常感谢,您的回答对我有帮助。
    猜你喜欢
    • 2021-04-14
    • 2021-01-14
    • 1970-01-01
    • 2020-10-01
    • 1970-01-01
    • 2020-11-10
    • 2019-11-10
    • 1970-01-01
    • 2017-11-05
    相关资源
    最近更新 更多