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

2024-06-25

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

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

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

看着ban-types.ts来自 GitHub TypeScript ESLint 的文件Link https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/rules/ban-types.ts#L56

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

"@typescript-eslint/ban-types": ["error",
    {
        "types": {
            "String": false,
            "Boolean": false,
            "Number": false,
            "Symbol": false,
            "{}": false,
            "Object": false,
            "object": false,
            "Function": false,
        },
        "extendDefaults": true
    }
]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

有人可以告诉我如何禁用 @typescript-eslint/ban-types 触发的所有内容吗? 的相关文章

随机推荐