简体   繁体   中英

How to add TSLint to VSCode Default Build task?

I have installed TSLint to VS Code.

In my angular app, how can I update VS Code to run TSLint against my source when I run the default build task?

TSLint for VS code is a visual help, not a build tool. Don't mix it up.

If you want to add a linter to your default build task, this will happen in your package.json :

"scripts": {
  "build": "ng build --prod"
}

replace this line with

"scripts": {
  "build": "ng lint; ng build --prod"
}

Now you can run

npm run build

and your project will lint before building.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM