VSCode and TSLint tasks
I was trying to get full project linting to happen using the TSLint Visual Studio Extension, but it currently only does one file at a time, for the files that are all open. To TSLint the whole project you need to setup a VSCode Task.
Installing Required Packages
npm install -g tslint typescript
Settings Up the Task
- In VSCode hit F1 and type task
- Select “Configure Task Runner”
- Select Typescript
In the tasks.json file add the following
{
"version": "0.1.0",
"command": "tslint",
"isShellCommand": true,
"echoCommand": true,
"args": [
"--format prose",
"--project ${workspaceRoot}/tsconfig.json",
"--type-check",
"${workspaceRoot}/src/**/*.ts"
],
"showOutput": "silent",
"isBackground": true,
"problemMatcher": "$tslint4"
}
Run the task in VSCode, the output will show in the output tab and in the Problem tab as well.
Happy Linting.