Why dos TSLint only checks src directory?
tsconfig.json
{
"compilerOptions": {
"outDir": "./built",
"allowJs": true,
"target": "es5",
"typeRoots": ["node_modules/@types", "typings"]
},
"include": ["./src/**/*", "./typings/**/*"],
"exclude": ["node_modules"]
}
tslint.json
{
"defaultSeverity": "error",
"extends": [
"tslint:recommended"
],
"jsRules": {},
"rules": {},
"rulesDirectory": []
}
Check the whole project
it only shows errors of src directory
tslint --project .
ERROR: /Users/kiwenlau/Desktop/tslint-test/src/index.ts:1:1 - Forbidden 'var' keyword, use 'let' or 'const' instead
Check src directory
tslint "src/**/*"
ERROR: src/index.ts:1:1 - Forbidden 'var' keyword, use 'let' or 'const' instead
Check typings directory
tslint "typings/**/*"
ERROR: typings/index.d.ts:1:11 - interface name must start with a capitalized I
please check kiwenlau/tslint-test for source code.
As mentioned in this github issue, TSLint ignores .d.ts
files when processing the include
paths from tsconfig.json
.
Unfortunately, TSLint is not in development anymore so this will never be changed. The official suggestion is to use ESLint with typescript-eslint instead. You can read more about that in this blog post.
If you'd like to keep using TSLint for the time being, you could specify both paths when calling it like this:
tslint "src/**/*" "typings/**/*"
Or a bit shorter like this:
tslint "{src,typings}/**/*"