简体   繁体   中英

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

I created a new project in Angular 13. I executed the following command to config typescript-eslint in the project:

ng add @angular-eslint/schematic

the following is my.eslintrc.json file where I have tried to turn "off" typescript-eslint/typedef and 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": {}
    }
  ]
}

I have restarted the ESlint server. I have restarted VS Code. I have punched myself in the face. I cannot get rid of the following sort of error in my code: 在此处输入图像描述

I have no clue how to fix this.

UPDATE with package.json snapshot

{
 
  "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"
  }
}

It appears that when I ran the following command:

ng add @angular-eslint/schematics

That the setup process did not complete. Running the following command made sure the whole setup was executed and thus made a majority of the errors go away:

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

Note - Reference link angular-eslint/angular-eslint

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM