Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the difference between setting rules in tsconfig.json vs tslint.json?

Tags:

typescript

It seems like they both achieve the same result. With TSLint, I had to install a plugin in VSCode? This probably is not preferable should someone in my team use a different editor.

like image 781
zer0 Avatar asked May 30 '18 14:05

zer0


2 Answers

tsconfig.json receives the configuration for the typescript compiler like allowing javascript files, the location of your files, etc.

tslint.json is the configuration for TSLint, TSLint helps you to detect bad coding practices or follow a coding style, you can configure its options like disallow unused variables, no logging to the console, etc. Also, TSLint is not just a plugin for vscode, so someone in your team can use the editor of its preference and still use TSLint.

See this links:

  • tsconfig.json
  • tslint.json
like image 188
piedra Avatar answered Nov 17 '22 19:11

piedra


TSConfig : Deals with the compiler. Throws an error on compiling bad code. So in Anguar "ng serve" will give you an error Ex Error => error TS6138: Property 'dialog' is declared but its value is never read.

TsLint : Its to ensure best practice is followed. It does not throw an error on compilation. However, it shows a red line on the code to tell you that your style of coding needs some changes. On VScode , you need to install a plugin to detect tslint. On webstorm , it is inbuilt

like image 1
Chandra Sagar Avatar answered Nov 17 '22 18:11

Chandra Sagar