繁体   English   中英

如何从 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,
        ...
     }
}

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

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

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

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

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

这在 tslint: 6.1.2 中对我有用。

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM