【问题标题】:How to run Nx serve for app with lint errors?如何为出现 lint 错误的应用程序运行 Nx 服务?
【发布时间】:2022-10-13 05:12:59
【问题描述】:

我有一个 nx Angular 项目,里面有一些 lint 规则

当我运行nx run shell:lint - 我得到了所有应该根据.eslintrc.json 配置文件的错误和警告,

但 nx run shell:serve - 构建和服务没有任何错误。

这是shell serve 操作的配置

  "serve": {
      "executor": "@nrwl/angular:webpack-server",
      "configurations": {
        "production": {
          "browserTarget": "shell:build:production"
        },
        "development": {
          "browserTarget": "shell:build:development"
        }
      },
      "defaultConfiguration": "development",
      "options": {}
  }

但是我想在服务/构建时从 linter 中获取错误,有什么办法吗?

我绝对可以在预提交挂钩上捕获所有这些,但仍然想在运行时编译中捕获它。

【问题讨论】:

    标签: angular lint nrwl-nx


    【解决方案1】:

    在您的应用程序project.json 文件中,在“serve”命令下,您可以添加“lint”命令作为依赖项。

    "serve": {
          "executor": "@nrwl/react:module-federation-dev-server",
          "defaultConfiguration": "development",
          "options": {
            "buildTarget": "container:build",
            "hmr": true,
            "port": 4200
          },
          "dependsOn": ["lint"],
          "configurations": {
    

    【讨论】:

      猜你喜欢
      • 2019-10-13
      • 1970-01-01
      • 1970-01-01
      • 2011-07-08
      • 2012-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-28
      相关资源
      最近更新 更多