NX/ANGLINT项目的Esslint配置(无主机元数据属性) [英] Esslint configuration for Nx/Angular project (no-host-metadata-property)
本文介绍了NX/ANGLINT项目的Esslint配置(无主机元数据属性)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望将规则@angular-eslint/no-host-metadata-property
转换为警告而不是错误,但我不知道如何配置它。
错误消息如下:
使用@HostBinding或@HostListener而不是host
元数据
属性(https://angular.io/styleguide#style-06-03)
@角度eslint/无主机元数据属性
这是我在根级别的eslintrc.json
文件中尝试的内容:
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["@nrwl/nx"],
"overrides": [
{
"files": ["*.ts"],
"rules": {
....
"@angular-eslint/no-host-metadata-property": "warn",
}
"plugins": ["@angular-eslint/eslint-plugin", "eslint-plugin-import", "@typescript-eslint"]
}
}
这是一个角度为12的项目。我运行了nx迁移命令,将linting规则从tslint转换为eslint。如何覆盖该规则?
推荐答案
在根级别上进行更改是徒劳的,因为您的项目的.eslintrc.json
将覆盖这些更改,因为@nrwl/nx/angular
是在覆盖部分中设置的。
很遗憾,您必须在"覆盖"部分中设置"这是所有项目"。
如果您有多个项目和/或需要应用的多个更改,您可以将其解压缩到eslint-custom-overrides.json
文件中,并将其用作extends
部分的最后一个:
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts"],
"extends": [
"plugin:@nrwl/nx/angular",
"plugin:@angular-eslint/template/process-inline-templates"
"../../eslintrc-custom-overrides.json"
],
},
...
],
...
}
您的eslintrc-custom-overrides.json
将如下所示:
{
"overrides": [
{
"files": ["*.ts"],
"rules": {
"@angular-eslint/no-host-metadata-property": "warn"
}
}
]
}
查看有关NX Issue的更多详细信息。
这篇关于NX/ANGLINT项目的Esslint配置(无主机元数据属性)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文