ESlint SyntaxError:无法加载在“.eslintrc.json#overrides[0]”中声明的插件“@angular-eslint”:意外的标记“??=”

Alf*_*usk 7 angular-eslint

我有干净的(只有 eslint 和 prettier)Angular 16 项目和这个 package.json。我的 IDE 显示错误,屏幕截图位于帖子页脚上。在Angular版本较低的项目中,不存在这个错误。

{
  "name": "my-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "lint": "ng lint"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^16.0.0",
    "@angular/common": "^16.0.0",
    "@angular/compiler": "^16.0.0",
    "@angular/core": "^16.0.0",
    "@angular/forms": "^16.0.0",
    "@angular/platform-browser": "^16.0.0",
    "@angular/platform-browser-dynamic": "^16.0.0",
    "@angular/router": "^16.0.0",
    "rxjs": "~7.8.0",
    "tslib": "^2.3.0",
    "zone.js": "~0.13.0"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^16.0.0",
    "@angular-eslint/builder": "16.0.1",
    "@angular-eslint/eslint-plugin": "16.0.1",
    "@angular-eslint/eslint-plugin-template": "16.0.1",
    "@angular-eslint/schematics": "16.0.1",
    "@angular-eslint/template-parser": "16.0.1",
    "@angular/cli": "~16.0.0",
    "@angular/compiler-cli": "^16.0.0",
    "@types/jasmine": "~4.3.0",
    "@typescript-eslint/eslint-plugin": "5.59.2",
    "@typescript-eslint/parser": "5.59.2",
    "eslint": "^8.39.0",
    "eslint-config-prettier": "^8.8.0",
    "eslint-plugin-prettier": "^4.2.1",
    "jasmine-core": "~4.6.0",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.2.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.1.0",
    "karma-jasmine-html-reporter": "~2.0.0",
    "prettier": "^2.8.8",
    "prettier-eslint": "^15.0.1",
    "typescript": "~5.0.2"
  }
}

Run Code Online (Sandbox Code Playgroud)

eslintrc

{
  "root": true,
  "ignorePatterns": [
    "projects/**/*"
  ],
  "overrides": [
    {
      "files": [
        "*.ts"
      ],
      "extends": [
        "eslint:recommended",
        "plugin:@typescript-eslint/recommended",
        "plugin:@angular-eslint/recommended",
        "plugin:@angular-eslint/template/process-inline-templates"
      ],
      "rules": {
        "@angular-eslint/directive-selector": [
          "error",
          {
            "type": "attribute",
            "prefix": "app",
            "style": "camelCase"
          }
        ],
        "@angular-eslint/component-selector": [
          "error",
          {
            "type": "element",
            "prefix": "app",
            "style": "kebab-case"
          }
        ]
      }
    },
    {
      "files": [
        "*.html"
      ],
      "extends": [
        "plugin:@angular-eslint/template/recommended",
        "plugin:@angular-eslint/template/accessibility"
      ],
      "rules": {}
    }
  ]
}

Run Code Online (Sandbox Code Playgroud)

我有这个问题

错误在哪里?

干净的项目。我怀疑问题出在某个软件包的版本上,但我无法弄清楚是哪个软件包

JSO*_*ulo 9

Angular ESLint v16 放弃了对 Node v14 的支持,如其发行说明中所述。我能够在 Node 14 环境中重现该错误。

要修复该错误,请在系统上安装 Node v16.13.0 或更高版本。另请检查您的 IDE 设置,以便它使用正确的 Node 版本。