简体   繁体   English

有人能告诉我如何禁用由@typescript-eslint/ban-types 触发的所有内容吗?

[英]can someone tell me how to disable everything that's triggered by @typescript-eslint/ban-types?

This "@typescript-eslint/ban-types" gives me nightmares.这个“@typescript-eslint/ban-types”让我做噩梦。 I work on a large project and it generates large errors (in hundreds) that cannot be easily fixed.我从事一个大型项目,它产生了无法轻易修复的大错误(数百个)。

This is the configuration that I have however does the stupid eslint does not want to take it:这是我的配置但是愚蠢的 eslint 不想接受它:

 //
        // Typescript
        "@typescript-eslint/ban-types": [
            "error",
            {
                types: {
                    "{}": false,
                    Function: false,
                },
                extendDefaults: true,
            },
        ],

Looking at the ban-types.ts file from GitHub TypeScript ESLint Link查看来自 GitHub TypeScript ESLint Linkban-types.ts文件

Add this to your .eslintrc file to ignore the default ban-types.将此添加到您的.eslintrc文件以忽略默认禁止类型。

"@typescript-eslint/ban-types": ["error",
    {
        "types": {
            "String": false,
            "Boolean": false,
            "Number": false,
            "Symbol": false,
            "{}": false,
            "Object": false,
            "object": false,
            "Function": false,
        },
        "extendDefaults": true
    }
]

You can also do this shorter by doing:您还可以通过执行以下操作来缩短此操作:

rules: {
  "@typescript-eslint/ban-types": "off"
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM