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

问题描述

这个“ @ typescript-eslint / ban-types”让我恶梦。我正在做一个大型项目,它会产生大错误(成百上千个),无法轻易修复。

这是我所拥有的配置,但是愚蠢的夹板不想接受它:

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

解决方法

从GitHub TypeScript ESLint Linkban-types.ts文件

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

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

您也可以通过以下方式缩短时间:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top"
    android:orientation="vertical">

        <TextView
            android:id="@+id/titleTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/white"
            android:textSize="16sp"
            android:textStyle="normal"
            android:typeface="sans" />

        <TextView
            android:id="@+id/linkTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:textColor="@color/white"
            android:textSize="12sp"
            android:textStyle="normal"
            android:typeface="sans" />

        <TextView
            android:id="@+id/dateTxt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:layout_marginTop="10dp"
            android:textColor="@color/white"
            android:textSize="12sp"
            android:textStyle="normal"
            android:typeface="sans" />


</LinearLayout>