DEV*_*_NF 5 typescript eslint angular eslintrc typescript-eslint
我的 Angular 项目(v13)的打字稿类上有以下代码片段:
import { Component } from '@angular/core';
import { MyService } from 'service';
@Component({
selector: 'app-example',
templateUrl: './example.component.html'
})
export class ExampleComponent {
constructor(
private myService: MyService
) {}
getUsers() {
this.myService.getUsers().subscribe(response => {
// do something;
})
}
}
Run Code Online (Sandbox Code Playgroud)
我使用 ESlint 版本 7.26.0 运行该项目并扩展了以下插件:
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"eslint:recommended"
Run Code Online (Sandbox Code Playgroud)
运行 ng lint 时遇到的 lint 错误是:
'mySerive' is defined but never used no-unused-vars
Run Code Online (Sandbox Code Playgroud)
显然,我的班级正在使用 myService。
这是预期的行为还是如何解决此问题?
PS:我不想禁用该规则。
通过将“plugin:@typescript-eslint/recommended”插件添加到 ESlint 配置来修复。
归档时间: |
|
查看次数: |
6013 次 |
最近记录: |