VS 代码的 TS lint 插件不跟踪关闭的文件

TS lint plugin for VS code doesn't track closed files

我正在使用 VSCode 1.17.2,并使用 tslint 插件来跟踪 lint 错误。截至目前,它可以很好地处理打开的文件,并在带有红色标记的文件上显示错误,并在问题选项卡中给出错误。但它不跟踪关闭的文件。我是否缺少任何配置?目前我使用的是默认配置。

扩展名见documentation

The extension lints an individual file only. If you want to lint your entire workspace or project and want to see the warnings in the Problems panel, then you can:

use gulp that or define a script inside the package.json that runs tslint across your project.

define a VS Code task with a problem matcher that extracts VS Code warnings from the tslint output.

For example, here is an excerpt from a package.json file that defines a script to run tslint:

{
  "name": "tslint-script-demo",
  "version": "1.0.0",
  "scripts": {
    "lint": "tslint tests/*.ts -t verbose"
  },
  "devDependencies": {
    "typescript": "^2.2.2",
    "tslint": "^5.0.0"   }
}

Next, define a Task which runs the npm script with a problem matcher that extracts the tslint errors into warnings.

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "npm",
            "script": "lint",
            "problemMatcher": {
                "base": "$tslint5",
                "fileLocation": "relative"
            }
        }
    ]
}

Finally, when you then run the tslint task you will see the warnings produced by the npm script in the Problems panel and you can navigate to the errors from there.

Here is the complete setup example setup.