【发布时间】:2022-01-22 13:48:05
【问题描述】:
我有 2 个标题,每个标题都在后面。但我的eslint 不引发错误。我需要在我的..eslintrc.json 文件中添加更多配置吗?我还需要手动添加所有规则吗?
这是我的配置文件:
{
"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"
}
]
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"@angular-eslint/template/accessibility-alt-text": "error",
"@angular-eslint/prefer-on-push-component-change-detection": "error",
"@angular-eslint/no-pipe-impure": "error"
}
}
]
}
html:
<app-forecast></app-forecast>
<app-notification-list></app-notification-list>
<div class="container">
<h1>Title one</h1>
<h1>Title two</h1> //no error
<img [src]="'https://picsum.photos/200/300'" />
<div class="row">
<div class="col-sm">
<app-na-article-list></app-na-article-list>
</div>
</div>
</div>
【问题讨论】: