[英]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:我在 Angular 13 中创建了一个新项目。我执行以下命令在项目中配置 typescript-eslint:
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:以下是 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": {}
}
]
}
I have restarted the ESlint server.我已经重新启动了 ESlint 服务器。 I have restarted VS Code.
我已经重新启动了 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更新 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"
}
}
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:
运行以下命令可确保执行了整个设置,从而消除了大部分错误 go:
ng add @angular-eslint/schematics --skip-confirmation
Note - Reference link angular-eslint/angular-eslint注意 - 参考链接angular-eslint/angular-eslint
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.