如何从 tslint 中排除文件夹?

How to exclude a folder from tslint?

我想在 vscode 中使用 tslint 排除 test 文件夹形式。所以我在我的 tslint.json 配置文件中放置了一个排除项。不幸的是,排除语句不起作用。有人知道如何设置排除吗?

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

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

更新: 对于那些使用 VSCode 和 tslint 作为 editor/linting 的人,您可以将以下内容添加到 VSCode 配置中:

 // Configure glob patterns of file paths to exclude from linting
"tslint.exclude": "**/PATH_eg_TESTS/**/*.ts"

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

{
  "linterOptions": {
    "exclude": [
      "bin",
      "build",
      "config",
      "coverage",
      "node_modules"
    ]
  }
}

这在 tslint 中对我有用:6.1.2。

In the root folder where tslint.json is located create the file path to directory.

"linterOptions": {
  "exclude": [
    "libs/folder/folder/**",
    "apps/stuff/stuff/**"
  ]
}