javascript - 禁用 eslint 的主机配置
问题描述
我在角度应用程序中使用 eslint,在执行ng lint
时出现以下错误
An unhandled exception occurred: .eslintrc.json#overrides[0]:
Configuration for rule "@angular-eslint/directive-selector" is invalid:
Value {"type":"attribute","style":"camelCase","use-host-property-decorator":false} should NOT have additional properties.
尝试从配置中禁用主机,如下所示
.eslintrc
"rules": {
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
// "prefix": "app",
"style": "camelCase",
"use-host-property-decorator": false
}
],
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
]
}
我在指令中使用了主机
@Directive({
selector: 'th[sortable]',
host: {
'[class.asc]': 'direction === "asc"',
'[class.desc]': 'direction === "desc"',
'(click)': 'rotate()'
}
})
解决方案
推荐阅读
- java - 已解决:带有 TabLayout 和 FragmentPagerAdapter 和 ViewPager 的应用程序崩溃
- java - 无法解析 mojo org.apache.maven.plugins:maven-assembly-plugin:3.1.1 的配置
- regex - 使用正则表达式进行智能(迭代和增量)复制和粘贴
- python-3.x - 是否有可能将启动参数传递给 setup.py 测试
- android - 交换片段时是否需要始终重新创建片段?
- android - 切换到另一个应用程序时 Paho Android MQTT 连接丢失
- android - 让 Android 上的 WebView 使用 prefers-color-scheme: dark
- react-native - React Native - 在标题中添加搜索栏
- python - ImportError: Couldn't import Django ... 你忘记激活虚拟环境了吗?
- boto3 - Boto3 调用文本的请求无效