12

我喜欢test在 vscode 中排除使用 tslint linting 的文件夹表单。所以我在我的 tslint.json 配置文件中放置了一个排除项。不幸的是,排除语句不起作用。有谁知道如何设置排除?

 {
    "exclude": "tests/**/*.ts",
    "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
    "rules": {
        "export-name": true,
        ...
     }
}
4

3 回答 3

6

最新更新:现在可以在 tslint.json 中设置(以下配置适用于 tslint 5.11)

{
  "linterOptions": {
    "exclude": [
      "bin",
      "build",
      "config",
      "coverage",
      "node_modules"
    ]
  }
}
于 2018-05-28T03:29:19.603 回答
5

这似乎是一个开放的功能请求。更多信息可以在这里找到:https ://github.com/palantir/tslint/issues/73

更新: 对于那些使用 tslint 作为编辑器/lint 的 VSCode,您可以将以下内容添加到 VSCode 配置中:

 // Configure glob patterns of file paths to exclude from linting
"tslint.exclude": "**/PATH_eg_TESTS/**/*.ts"
于 2016-09-22T07:20:25.337 回答
2

这在 tslint: 6.1.2 中对我有用。

在 tslint.json 所在的根文件夹中,创建目录的文件路径。

"linterOptions": {
  "exclude": [
    "libs/folder/folder/**",
    "apps/stuff/stuff/**"
  ]
}
于 2020-08-06T14:38:55.760 回答