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?
问问题
966 次
2 回答
1
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" ]
于 2017-04-17T10:44:38.623 回答
-1
"typedef-whitespace": [
true,
{
"call-signature": "nospace",
"index-signature": "nospace",
"parameter": "nospace",
"property-declaration": "nospace",
"variable-declaration": "nospace"
},
{
"call-signature": "onespace",
"index-signature": "onespace",
"parameter": "onespace",
"property-declaration": "onespace",
"variable-declaration": "onespace"
}
于 2017-08-28T21:09:53.163 回答