tslint 如何禁用错误 "someVariable is declared but its value is never read"

标签 tslint

我正在使用 tslint,并收到错误。

'myVariable' is declared but its value is never read.

我访问了记录规则的网站 https://palantir.github.io/tslint/rules/并搜索字符串is声明但其值从未读取但没有找到该文本。虽然我可以并且确实寻找可能与此错误相关的设置,但这不应该是一个猜测游戏。

抑制/停止此错误所需的配置更改是什么?

同样重要的是,当我在 tslint 中收到“发生了这种情况”的错误时,我如何找到用于配置或更改 tslint 行为以了解如何处理该错误的设置?

我还在网站上进行了搜索(我使用的是谷歌搜索)

site:palantir.github.io  is declared but its value is never read 

但是没有出现直接点击,所以答案可能在 palantir.github.io 网站上,但我(还)没有找到它。

其他人如何找到更改以抑制特定错误的 tslint 变量/配置设置?

请不要建议我注释掉导致问题的代码。我正在寻找更普遍的问题以及具体问题的答案。谢谢。

最佳答案

任何以 _ 开头的参数名称都不受检查。使用 _myVariable 而不是 myvariable 来删除此警告。

关于tslint 如何禁用错误 "someVariable is declared but its value is never read",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50011443/

相关文章:

typescript - TSLint:未使用的 var 关键字

webstorm - 如何在 webstorm 中从 tslint.json 导入代码格式设置?

gulp - 在 vscode 中,由带有 isWatching 的任务生成的错误在修复后并不总是清除

不同文件上的 Angular cli lint 错误导出

typescript - 当 tslint 中的 "no-floating-promises"为真时如何忽略 Jasmine promise

angular - 如何抑制来自 npm 链接包的 tslint 警告?

typescript - 禁止在 Typescript 中将任何类型的变量分配给其他类型的变量

javascript - 如何运行 tslint.json?

javascript - 对象或数组的首选声明约定是什么 : const or let?

angular - tslint 错误阴影名称 : 'Observable'