For example, when I have the following TypeScript code
const bar = <foo>{ answer: 42 }
tslint issues a warning 'missing whitespace' between >
and {
. So, to fix it, I have to write:
const bar = <foo> { answer: 42 }
However, every time I format my file in vs code (SHIFT+ALT+F), my formatting is reset to the version at the top, causing a new tslint issue. As I cannot change the formatting rules in vs code, do I need to add a rule to tslint or editorconfig?
You could change the tslint.json and edit whitespace
rule in your project.
Your example looks like the check-typecast
setting.
"check-typecast" checks for whitespace between a typecast and its target.
As suggested override your rule set with:
"whitespace": [true, "check-branch", "check-decl", "check-operator", "check-separator", "check-type" ]