How to exclude a folder from tslint?
Asked Answered
T

3

14

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,
        ...
     }
}
Titivate answered 8/9, 2016 at 10:27 Comment(0)
T
5

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"
Titivate answered 22/9, 2016 at 7:20 Comment(1)
It worked for me in the array form: "tslint.exclude": "**/schematics/**/files/*.ts" Thanks!Trahurn
W
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"
    ]
  }
}
Wixted answered 28/5, 2018 at 3:29 Comment(1)
Should be noted that the final PR uses linterOptions rather than cliOptions: github.com/palantir/tslint/pull/2409#issuecomment-289464766Coryden
T
5

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"
Titivate answered 22/9, 2016 at 7:20 Comment(1)
It worked for me in the array form: "tslint.exclude": "**/schematics/**/files/*.ts" Thanks!Trahurn
A
2

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/**"
  ]
}
Applicant answered 6/8, 2020 at 14:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.