第一层
tsconfig.json 中配置 exclude,将想跳过的文件夹配置到 exclude 中
{
"exclude": ["node_modules/**"]
}
第二层
tsconfig.json 中额外配置 include,将需要校验的文件夹配置到 include 中
{
"include": ["src/**/*"],
"exclude": ["node_modules/**"],
}
第三层
tsconfig.json 中在添加配置 “skipLibCheck”: true
{
"compilerOptions": {
"skipLibCheck": true
},
"include": ["src/**/*"],
"exclude": ["node_modules/**"],
}
第四层
上述都配了的话,如果还有问题,可能使用的一些库依赖的是高版本的 ts 和 es, 需要升级 typescript 至 4 版本 eslint 7 版本,即可解决