【发布时间】:2021-10-25 15:13:44
【问题描述】:
我正在处理一个 Angular 项目,但我的 ESLint 设置未检测到私有类变量何时未使用,例如
@Component{...}
export class ExampleComponent {
private exampleProperty: string
}
上面的私有属性 - exampleProperty 不会使用我当前的 ESLint 设置突出显示。
我的.eslintrc.json:
{
"root": true,
"ignorePatterns": ["projects/**/*"],
"overrides": [
{
"files": ["*.ts"],
"parserOptions": {
"project": ["tsconfig.json", "e2e/tsconfig.json"],
"createDefaultProgram": true
},
"env": { "browser": true, "jest": true },
"extends": [
"eslint:recommended",
"plugin:@angular-eslint/recommended",
"plugin:@angular-eslint/template/process-inline-templates",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"@angular-eslint/component-selector": [
"error",
{ "prefix": "app", "style": "kebab-case", "type": "element" }
],
"@angular-eslint/no-host-metadata-property": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{ "argsIgnorePattern": "^_" }
],
"no-case-declarations": "off",
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-prototype-builtins": "off",
"no-unused-vars": "off"
}
},
{
"files": ["*.html"],
"extends": ["plugin:@angular-eslint/template/recommended"],
"rules": {}
}
]
}
我怎样才能让 linter 把它捡起来?
【问题讨论】:
标签: angular typescript eslint typescript-eslint