Nx: angular: angular-eslint is not included initially using create-nx-workspace angular preset with --linter=eslint

Created on 12 Dec 2020  路  1Comment  路  Source: nrwl/nx

Current Behavior

  1. The @angular-eslint/* packages are not included in package.json#devDependencies (or at all).
  2. The @angular-devkit/build-angular:tslint builder is used for the lint architect target of the initial projects in angular.json.
  3. tslint.json configurations are added to the workspace.

Expected Behavior



In the initial Angular application project:

  1. The @angular-eslint/eslint-plugin, @angular-eslint/eslint-plugin-template, and @angular-eslint/template-parser packages are included in package.json#devDependencies.
  2. The lint architect targets for the initial projects should use the @nrwl/linter:eslint builder.
  3. .eslintrc.json configurations are added to the workspace.

Steps to Reproduce

Tried using Nx 11.0.0 and Nx 11.0.2.

Running

yarn create nx-workspace nx-cli1102-angular-workspace --npm-scope=nx --preset=angular --no-nx-cloud --package-manager=yarn --app-name=angular-app --prefix=app --linter=eslint --strict --no-interactive

or

npx create-nx-workspace nx-cli1102-angular-workspace --npm-scope=nx --preset=angular --no-nx-cloud --package-manager=yarn --app-name=angular-app --prefix=app --linter=eslint --strict --no-interactive

or

npm init nx-workspace nx-cli1102-angular-workspace --npm-scope=nx --preset=angular --no-nx-cloud --package-manager=yarn --app-name=angular-app --prefix=app --linter=eslint --strict --no-interactive

(notice --linter=eslint)

However, when I generate another Angular application or library project, angular-eslint and ESlint are added, for example when I run

ng generate @nrwl/angular:application --name=other-angular-app --style=scss --linter=eslint --prefix=app --strict --routing=false

Failure Logs

Environment



nx report

  Node : 10.19.0
  OS   : win32 x64
  npm  : 6.13.4

  nx : Not Found
  @nrwl/angular : 11.0.2
  @nrwl/cli : 11.0.2
  @nrwl/cypress : 11.0.2
  @nrwl/devkit : 11.0.2
  @nrwl/eslint-plugin-nx : Not Found
  @nrwl/express : Not Found
  @nrwl/jest : 11.0.2
  @nrwl/linter : 11.0.2
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : Not Found
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 11.0.2
  @nrwl/web : Not Found
  @nrwl/workspace : 11.0.2
  typescript : 4.0.5

Initial angular.json configuration

{
  "version": 1,
  "projects": {
    "angular-app": {
      "projectType": "application",
      "root": "apps/angular-app",
      "sourceRoot": "apps/angular-app/src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/apps/angular-app",
            "index": "apps/angular-app/src/index.html",
            "main": "apps/angular-app/src/main.ts",
            "polyfills": "apps/angular-app/src/polyfills.ts",
            "tsConfig": "apps/angular-app/tsconfig.app.json",
            "aot": true,
            "assets": [
              "apps/angular-app/src/favicon.ico",
              "apps/angular-app/src/assets"
            ],
            "styles": ["apps/angular-app/src/styles.scss"],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "apps/angular-app/src/environments/environment.ts",
                  "with": "apps/angular-app/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "angular-app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "angular-app:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular-app:build"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/angular-app/tsconfig.app.json",
              "apps/angular-app/tsconfig.spec.json",
              "apps/angular-app/tsconfig.editor.json"
            ],
            "exclude": ["**/node_modules/**", "!apps/angular-app/**/*"]
          }
        },
        "test": {
          "builder": "@nrwl/jest:jest",
          "outputs": ["coverage/apps/angular-app"],
          "options": {
            "jestConfig": "apps/angular-app/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "angular-app-e2e": {
      "root": "apps/angular-app-e2e",
      "sourceRoot": "apps/angular-app-e2e/src",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/angular-app-e2e/cypress.json",
            "tsConfig": "apps/angular-app-e2e/tsconfig.e2e.json",
            "devServerTarget": "angular-app:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "angular-app:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": ["apps/angular-app-e2e/tsconfig.e2e.json"],
            "exclude": ["**/node_modules/**", "!apps/angular-app-e2e/**/*"]
          }
        }
      }
    }
  },
  "cli": {
    "defaultCollection": "@nrwl/angular"
  },
  "schematics": {
    "@nrwl/angular": {
      "application": {
        "linter": "eslint"
      },
      "library": {
        "linter": "eslint"
      },
      "storybook-configuration": {
        "linter": "eslint"
      }
    },
    "@nrwl/angular:application": {
      "unitTestRunner": "jest",
      "e2eTestRunner": "cypress"
    },
    "@nrwl/angular:library": {
      "unitTestRunner": "jest"
    }
  },
  "defaultProject": "angular-app"
}

angular.json configuration after generating second Angular application project

{
  "version": 1,
  "projects": {
    "angular-app": {
      "projectType": "application",
      "root": "apps/angular-app",
      "sourceRoot": "apps/angular-app/src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/apps/angular-app",
            "index": "apps/angular-app/src/index.html",
            "main": "apps/angular-app/src/main.ts",
            "polyfills": "apps/angular-app/src/polyfills.ts",
            "tsConfig": "apps/angular-app/tsconfig.app.json",
            "aot": true,
            "assets": [
              "apps/angular-app/src/favicon.ico",
              "apps/angular-app/src/assets"
            ],
            "styles": ["apps/angular-app/src/styles.scss"],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "apps/angular-app/src/environments/environment.ts",
                  "with": "apps/angular-app/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "angular-app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "angular-app:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "angular-app:build"
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": [
              "apps/angular-app/tsconfig.app.json",
              "apps/angular-app/tsconfig.spec.json",
              "apps/angular-app/tsconfig.editor.json"
            ],
            "exclude": ["**/node_modules/**", "!apps/angular-app/**/*"]
          }
        },
        "test": {
          "builder": "@nrwl/jest:jest",
          "outputs": ["coverage/apps/angular-app"],
          "options": {
            "jestConfig": "apps/angular-app/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "angular-app-e2e": {
      "root": "apps/angular-app-e2e",
      "sourceRoot": "apps/angular-app-e2e/src",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/angular-app-e2e/cypress.json",
            "tsConfig": "apps/angular-app-e2e/tsconfig.e2e.json",
            "devServerTarget": "angular-app:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "angular-app:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": ["apps/angular-app-e2e/tsconfig.e2e.json"],
            "exclude": ["**/node_modules/**", "!apps/angular-app-e2e/**/*"]
          }
        }
      }
    },
    "other-angular-app": {
      "projectType": "application",
      "root": "apps/other-angular-app",
      "sourceRoot": "apps/other-angular-app/src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/apps/other-angular-app",
            "index": "apps/other-angular-app/src/index.html",
            "main": "apps/other-angular-app/src/main.ts",
            "polyfills": "apps/other-angular-app/src/polyfills.ts",
            "tsConfig": "apps/other-angular-app/tsconfig.app.json",
            "aot": true,
            "assets": [
              "apps/other-angular-app/src/favicon.ico",
              "apps/other-angular-app/src/assets"
            ],
            "styles": ["apps/other-angular-app/src/styles.scss"],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "apps/other-angular-app/src/environments/environment.ts",
                  "with": "apps/other-angular-app/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ]
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "other-angular-app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "other-angular-app:build:production"
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "other-angular-app:build"
          }
        },
        "lint": {
          "builder": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": [
              "apps/other-angular-app/src/**/*.ts",
              "apps/other-angular-app/src/**/*.html"
            ]
          }
        },
        "test": {
          "builder": "@nrwl/jest:jest",
          "outputs": ["coverage/apps/other-angular-app"],
          "options": {
            "jestConfig": "apps/other-angular-app/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "other-angular-app-e2e": {
      "root": "apps/other-angular-app-e2e",
      "sourceRoot": "apps/other-angular-app-e2e/src",
      "projectType": "application",
      "architect": {
        "e2e": {
          "builder": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/other-angular-app-e2e/cypress.json",
            "tsConfig": "apps/other-angular-app-e2e/tsconfig.e2e.json",
            "devServerTarget": "other-angular-app:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "other-angular-app:serve:production"
            }
          }
        },
        "lint": {
          "builder": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["apps/other-angular-app-e2e/**/*.{js,ts}"]
          }
        }
      }
    }
  },
  "cli": {
    "defaultCollection": "@nrwl/angular"
  },
  "schematics": {
    "@nrwl/angular": {
      "application": {
        "linter": "eslint"
      },
      "library": {
        "linter": "eslint"
      },
      "storybook-configuration": {
        "linter": "eslint"
      }
    },
    "@nrwl/angular:application": {
      "unitTestRunner": "jest",
      "e2eTestRunner": "cypress",
      "strict": true
    },
    "@nrwl/angular:library": {
      "unitTestRunner": "jest"
    }
  },
  "defaultProject": "angular-app"
}
core bug

Most helpful comment

Fixed in 11.0.8. Thank you!

>All comments

Fixed in 11.0.8. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Koslun picture Koslun  路  3Comments

markphip picture markphip  路  3Comments

jasedwards picture jasedwards  路  3Comments

SWGeekPD picture SWGeekPD  路  3Comments

joelmuskwe picture joelmuskwe  路  3Comments