reactjs - 如何使用 husky precommit 捕获未使用的变量
问题描述
在我的 react/typescript 项目中,我对 tslint 使用了 no-unused-variable规则。因此,如果没有未使用的变量或导入,它将阻止提交。现在它说,它已被弃用并在 tsconfig 文件中使用noUnusedLocals和 **noUnusedParameters* 。
我是这样用的。
"compilerOptions": {
"target": "es6",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"noUnusedLocals": true,
"noUnusedParameters": true,
// other rules
}
现在未使用的变量被突出显示为警告,但预提交无法捕获它们。
我怎样才能解决这个问题?
解决方案
推荐阅读
- neural-network - 定制的 NN 层,每个层都有自己的前向函数 PyTorch
- dockerfile - 构建 docker 镜像以匹配主机版本
- android - Retrofit2 和 OkHttp3 仅在发生错误时使用缓存,例如网络错误或达到配额限制
- amazon-web-services - AWS Cloud9 IDE“本地主机拒绝连接”。在访问 docker 容器时
- dllimport - 无法连接HCNetSDK.dll初始化海康摄像头
- java - 对于 Appium 项目,我遇到错误“构造函数 URL(String) 引用了缺少的类型 MalformedURLException”
- file - Dart - HTTPClient 下载文件到字符串
- linux - 到 Linux PCIe 设备驱动程序的功能级别重置通知
- google-chrome - 邮递员拦截器请求永远运行
- powershell - 检查备份是否运行的脚本