如何为明确类型设置 TSLint

How to Setup TSLint for Definitely Typed

我为 Definitely Typed 更改了一个文件,当我创建拉取请求时,由于格式错误而失败。我假设这是 TsLint。我以前从未设置过它。我如何在本地设置它,以便在使用 VSCode?

提交之前捕获这些错误

目前我已经在全球安装了 TSLint:

npm install -g tslint typescript

并且我已经安装了 TSLint 扩展...但是我在保存文件时没有看到任何错误。我需要告诉它开始工作吗?

我是 VSCode 以及 TSLint 和 Node 的新手,所以越具体越好。

更新

我现在看到这个错误:

vscode-tslint: Cannot read tslint configuration - 'Failed to load c:\Users\dlabar\Documents\GitHub\DefinitelyTyped\types\xrm\tslint.json: Invalid "extends" configuration value - could not require "dtslint/dt.json". Review the Node lookup algorithm (https://nodejs.org/api/modules.html#modules_all_together) for the approximate method TSLint uses to find the referenced configuration file.'

显然需要节点 7+:https://github.com/Microsoft/dtslint/issues/29

已升级,一切正常。

我运行进入了类似的错误信息;但是,就我而言,这是由于没有安装 tslint.json 引用的新依赖项。 运行 yarn install(对你来说可能是 npm install)在我项目的根目录中修复了这个问题。