typescript - TSLint 不会抱怨缺少导入
问题描述
TSLint 不会抱怨缺少导入(但是,我不能console.log
在代码中留下语句)。Linter 说我的代码没有问题,但它没有编译。如何配置 TSLint 以抱怨缺少导入问题?
这是我的 TSLint 配置:
{
"extends": ["tslint:latest", "tslint-react", "tslint-react-hooks", "tslint-config-prettier"],
"rulesDirectory": [],
"rules": {
"max-line-length": {
"options": [120]
},
"new-parens": true,
"no-arg": true,
"no-conditional-assignment": true,
"no-consecutive-blank-lines": false,
"no-console": {
"severity": "warning",
"options": ["debug", "log", "time", "timeEnd", "trace"]
},
"interface-name": false,
"no-empty-interface": false,
"object-literal-sort-keys": false,
"arrow-parens": false,
"no-namespace": false,
"no-submodule-imports": false,
"no-implicit-dependencies": false,
"variable-name": false,
"no-conditional-assignment": false,
"jsx-no-lambda": false,
"only-arrow-functions": false,
"object-literal-sort-keys": false,
"ordered-imports": false,
"no-string-literal": false,
"no-bitwise": false,
"ban-types": {
"options": []
},
"typedef": true,
"prefer-for-of": false,
"no-duplicate-imports": false,
"no-empty": { "severity": "warning" },
"no-require-imports": { "severity": "warning" },
"no-var-requires": { "severity": "warning" }
},
"jsRules": {
"max-line-length": {
"options": [120]
},
"no-console": {
"severity": "warning",
"options": ["debug", "log", "time", "timeEnd", "trace"]
}
}
}
解决方案
我认为原因是您或 libdeclare
您在某处导入的内容是什么.d.ts
。在这种情况下,如果您没有导入,打字稿类型系统就不会抱怨它,因为它可能是全局的。
推荐阅读
- android - 单击列表视图项后的图像滑块
- android - 在我的应用程序中实施/集成谷歌语音操作/谷歌助手
- java - 如何在按下按钮时弹跳或缩放动画
- mysql - 如何通过增加批量更新中的值来更新字段
- sql-server - 案例语句中的硬代码日期比较
- android - 是否已备份本机 iOS / Android 密钥存储并且可以转移它们?
- c# - Foreach 循环仅遵循 C# 中 SQL Server 中的第一行数据表进行指纹验证
- php - html head js 文件不适用于动态引导模式
- ios - 如何在文本字段中输入 textFieldDidEndEditing 后的值
- php - SLIM 错误 :: 当 SLIM 应用程序托管在服务器上时找不到 AuthController