I have installed TSLint in VSCode and created a tslint.json
file next to tsconfig.json
. But TSLint is not working. For example, I added "curly": true
to tslint.json
, but when I write a if statement without curly braces, VS Code doesn't give any warning. What does this extension do?
Installing TSLint on an existing projectThe first line installs tslint as a devDependency. The second line run tslint using yarn, this way I don't have to write ./node_modules/. bin/tslint . As I have an existing TypeScript project, I'll point tslint to the project configuration file.
TSLint is an extensible static analysis tool that checks TypeScript code for readability, maintainability, and functionality errors. It is widely supported across modern editors & build systems and can be customized with your own lint rules, configurations, and formatters.
On a new machine, I installed VS Code tslint extension before installing tslint itself (via npm), and nothing helped to make it work other than disabling and re-enabling the extension.
The vscode-tslint extension currently crashes silently when it encounters an invalid config-option. In my case, it was the no-trailing-comma
rule which has to be changed to trailing-comma
.
More info here: https://github.com/Microsoft/vscode-tslint/issues/66
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With