Reputation: 4404
clearFile()
{
(<HTMLInputElement>document.getElementById('uploadFile')).value = "";
}
Gives
[tslint] misplaced opening brace
.
And if I use the opening braces in same line of function, it doesn't give me warning like
clearFile(){
(<HTMLInputElement>document.getElementById('uploadFile')).value = "";
}
This rule is called "one-line" rule And how to configure it in TSLint to handle first type of braces style
Thanks in advance
Upvotes: 6
Views: 6838
Reputation: 4404
If you want to globally turn of Goto {ProjectDirectoty}/tslint.json and add "one-line" : false in rules
One-line has 5 sub rules as "check-catch", "check-finally", "check-else", "check-open-brace", "check-whitespace". You can understand it from name, like for catch you should or not write opening braces in same or next line.
{
"extends": "../tslint.json",
"rules": {
"one-line" : false,
"directive-selector": [
true,
"attribute",
"app",
"camelCase"
],
"component-selector": [
true,
"element",
"app",
"kebab-case"
]
}
}
If you want to turn off only specific subrule, use something like this
"one-line": [true, "check-catch", "check-finally", "check-else"]
It will turn on for these 3 rules and off for other 2 rules
And if you want to disable in a particular file
/* tslint:disable:rule1 rule2 rule3... */ in that file
Upvotes: 10