How to ignore a particular directory or file for tslint?
Update for tslint v5.8.0
As mentioned by Saugat Acharya, you can now update tslint.json CLI Options:
{ "extends": "tslint:latest", "linterOptions": { "exclude": [ "bin", "lib/*generated.js" ] }}
More information in this pull request.
This feature has been introduced with tslint 3.6
tslint \"src/**/*.ts\" -e \"**/__test__/**\"
You can now add --exclude (or -e) see PR here.
CLI
usage: tslint [options] file ...Options:-c, --config configuration file--force return status code 0 even if there are lint errors-h, --help display detailed help-i, --init generate a tslint.json config file in the current working directory-o, --out output file-r, --rules-dir rules directory-s, --formatters-dir formatters directory-e, --exclude exclude globs from path expansion-t, --format output format (prose, json, verbose, pmd, msbuild, checkstyle) [default: "prose"]--test test that tslint produces the correct output for the specified directory-v, --version current version
you are looking at using
-e, --exclude exclude globs from path expansion
Currently using Visual Studio Code and the command to disable tslint is
/* tslint:disable */
Something to note. The disable above disables ALL tslint rules on that page. If you want to disable a specific rule you can specify one/multiple rules.
/* tslint:disable comment-format *//* tslint:disable:rule1 rule2 rule3 etc.. */
Or enable a rule
/* tslint:enable comment-format */
In addition to Michael's answer, consider a second way: adding linterOptions.exclude to tslint.json
For example, you may have tslint.json
with following lines:
{ "linterOptions": { "exclude": [ "someDirectory/*.d.ts" ] }}