如何从tslint中排除文件夹?

时间:2016-09-08 10:27:08

标签: visual-studio-code lint tslint

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

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

3 个答案:

答案 0 :(得分:5)

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

<强>更新 对于那些使用vlode和tslint作为editor / lintinig的人,可以将以下内容添加到vscode配置中:

class Foo():
    def say(self, c):
        self.c = c
        print("Foo")

f = Foo()
Foo.say(f,"Speak!")
f.say("Speak!")

答案 1 :(得分:4)

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

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

答案 2 :(得分:1)

这在tslint中对我有用:6.1.2。

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

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