有人能告诉我如何禁用由@typescript-eslint/ban-types 触发的所有内容吗? [英] can someone tell me how to disable everything that's triggered by @typescript-eslint/ban-types?

查看:563
本文介绍了有人能告诉我如何禁用由@typescript-eslint/ban-types 触发的所有内容吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个@typescript-eslint/ban-types"让我做噩梦.我从事一个大型项目,它产生了无法轻易修复的大错误(数百个).

This "@typescript-eslint/ban-types" gives me nightmares. I work on a large project and it generates large errors (in hundreds) that cannot be easily fixed.

这是我的配置但是愚蠢的 eslint 不想接受它:

This is the configuration that I have however does the stupid eslint does not want to take it:

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

推荐答案

查看 GitHub TypeScript ESLint 中的 ban-types.ts 文件 链接

Looking at the ban-types.ts file from GitHub TypeScript ESLint Link

将此添加到您的 .eslintrc 文件以忽略默认禁止类型.

Add this to your .eslintrc file to ignore the default ban-types.

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

这篇关于有人能告诉我如何禁用由@typescript-eslint/ban-types 触发的所有内容吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆