【问题标题】:ng lint Could not find custom rule directory: codelyzer with Angular CLI on gitlab CIng lint 找不到自定义规则目录:在 gitlab CI 上使用 Angular CLI 的 codelyzer
【发布时间】:2022-06-29 03:41:06
【问题描述】:

ng lint 在 Gitlab CI 上失败,并显示错误消息 An unhandled exception occurred: Failed to load /builds/trade-up/trade-up/common/projects/trade-up-common/tslint.json: Could not find custom rule directory: codelyzer

ng lint 在我的本地机器上运行没有问题,但在 gitlab CI 上失败。

在trade-up-common 包中,我已将tslint.json 添加到.npmignore 文件中。 Codelyzer 包含在主要 Angular 应用程序和公共包的依赖项中。

【问题讨论】:

    标签: angular typescript gitlab lint


    【解决方案1】:

    你必须安装 codelyzer

    npm install codelyzer
    

    然后在规则目录中定义:

     "rulesDirectory": [
        "node_modules/codelyzer"
      ],
    

    【讨论】:

    • 不幸的是,这没有帮助。我在主应用程序和公共包中都尝试过这种方法,但无济于事。
    【解决方案2】:

    这实际上是由错误的导入引起的。父应用引用了我的自定义包的本地版本,而不是发布到 npm 的版本。

    【讨论】:

      猜你喜欢
      • 2019-07-30
      • 2017-03-15
      • 1970-01-01
      • 2021-05-18
      • 2014-03-28
      • 2014-10-30
      • 1970-01-01
      • 1970-01-01
      • 2021-07-08
      相关资源
      最近更新 更多