admin管理员组

文章数量:1208155

I like to exclude the test folder form linting with tslint in vscode. So I have placed an exclude into my tslint.json config file. Unfortunately the exclude statement is not working. Does any one know how to set the exclude up?

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

I like to exclude the test folder form linting with tslint in vscode. So I have placed an exclude into my tslint.json config file. Unfortunately the exclude statement is not working. Does any one know how to set the exclude up?

 {
    "exclude": "tests/**/*.ts",
    "rulesDirectory": ["node_modules/tslint-microsoft-contrib"],
    "rules": {
        "export-name": true,
        ...
     }
}
Share Improve this question edited Aug 6, 2020 at 14:39 SoEzPz 15.9k8 gold badges63 silver badges66 bronze badges asked Sep 8, 2016 at 10:27 Michael HoellerMichael Hoeller 24.2k12 gold badges45 silver badges70 bronze badges
Add a comment  | 

3 Answers 3

Reset to default 8

Latest update: this can now be set in in tslint.json (the following configuration works with tslint 5.11)

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

It seems that this is an open feature request. Further information can be found here: https://github.com/palantir/tslint/issues/73

Update: for those who use VSCode with tslint as editor/linting you can add the following to the VSCode config:

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

This worked for me in 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/**"
  ]
}

本文标签: javascriptHow to exclude a folder from tslintStack Overflow