簡體   English   中英

ESlint & Angular 13: 無法關閉 typescript-eslint/typedef

[英]ESlint & Angular 13: Unable to turn off typescript-eslint/typedef

我在 Angular 13 中創建了一個新項目。我執行以下命令在項目中配置 typescript-eslint:

ng add @angular-eslint/schematic

以下是 my.eslintrc.json 文件,我試圖在其中關閉“關閉”typescript-eslint/typedef 和 typescript-eslint/explicit-function-return-type:

{
  "root": true,
  "ignorePatterns": ["projects/**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "project": ["tsconfig.json"],
        "createDefaultProgram": true
      },
      "extends": [
        "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"
          }
        ],
        "@typescript-eslint/typedef": "off",
        "@typescript-eslint/explicit-function-return-type": "off"
      }
    },
    {
      "files": ["*.html"],
      "extends": ["plugin:@angular-eslint/template/recommended"],
      "rules": {}
    }
  ]
}

我已經重新啟動了 ESlint 服務器。 我已經重新啟動了 VS Code。 我打了自己的臉。 我無法擺脫代碼中的以下錯誤: 在此處輸入圖像描述

我不知道如何解決這個問題。

更新 package.json 快照

{
 
  "dependencies": {
    "@angular/animations": "~13.0.0",
    "@angular/common": "~13.0.0",
    "@angular/compiler": "~13.0.0",
    "@angular/core": "~13.0.0",
    "@angular/forms": "~13.0.0",
    "@angular/platform-browser": "~13.0.0",
    "@angular/platform-browser-dynamic": "~13.0.0",
    "@angular/router": "~13.0.0",
    "lodash-es": "^4.17.15",
    "luxon": "^2.3.0",
    "luxon-angular": "^5.0.0",
    "ngx-cookie-service": "^13.1.2",
    "ngx-mask": "^13.0.1",
    "rxjs": "~7.4.0",
    "tslib": "^2.3.0",
    "verge": "^1.10.2",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~13.0.1",
    "@angular-eslint/builder": "13.0.1",
    "@angular-eslint/eslint-plugin": "13.0.1",
    "@angular-eslint/eslint-plugin-template": "13.0.1",
    "@angular-eslint/schematics": "13.0.1",
    "@angular-eslint/template-parser": "13.0.1",
    "@angular/cli": "~13.0.1",
    "@angular/compiler-cli": "~13.0.0",
    "@types/jasmine": "~3.10.0",
    "@types/luxon": "^2.0.9",
    "@types/node": "^17.0.8",
    "@typescript-eslint/eslint-plugin": "5.3.0",
    "@typescript-eslint/parser": "5.3.0",
    "codelyzer": "^6.0.0",
    "del": "^6.0.0",
    "eslint": "^8.2.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^4.0.0",
    "fs": "0.0.1-security",
    "gulp": "4.0.2",
    "gulp-image": "^6.3.1",
    "gulp-nop": "0.0.3",
    "gulp-plumber": "^1.2.1",
    "jasmine-core": "~3.10.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "prettier": "^2.5.1",
    "protractor": "~7.0.0",
    "rxjs-tslint-rules": "^4.34.0",
    "ts-node": "~8.3.0",
    "typescript": "~4.4.3"
  }
}

看來,當我運行以下命令時:

ng add @angular-eslint/schematics

設置過程未完成。 運行以下命令可確保執行了整個設置,從而消除了大部分錯誤 go:

ng add @angular-eslint/schematics --skip-confirmation

注意 - 參考鏈接angular-eslint/angular-eslint

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM