2 typescript eslint typescript-typings
这个“@typescript-eslint/ban-types”让我做噩梦。我从事一个大型项目,它产生了无法轻易修复的大错误(数百个)。
这是我的配置但是愚蠢的 eslint 不想接受它:
//
// Typescript
"@typescript-eslint/ban-types": [
"error",
{
types: {
"{}": false,
Function: false,
},
extendDefaults: true,
},
],
Run Code Online (Sandbox Code Playgroud)
小智 12
您还可以通过执行以下操作来缩短此时间:
rules: {
"@typescript-eslint/ban-types": "off"
}
Run Code Online (Sandbox Code Playgroud)
查看ban-types.ts来自 GitHub TypeScript ESLint Link的文件
将此添加到您的.eslintrc文件以忽略默认的禁令类型。
"@typescript-eslint/ban-types": ["error",
{
"types": {
"String": false,
"Boolean": false,
"Number": false,
"Symbol": false,
"{}": false,
"Object": false,
"object": false,
"Function": false,
},
"extendDefaults": true
}
]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3946 次 |
| 最近记录: |