Reputation: 100381
There is the one-line
config where I can force the code, for example, else
to go in the same line as the if's }
.
"one-line": [
true,
"check-open-brace",
"check-catch",
"check-else",
"check-finally",
"check-whitespace"
],
What I want to do is keep these two as one-line
"one-line": [
true,
"check-open-brace",
"check-whitespace"
],
but force others to go in a separated line
"check-catch",
"check-else",
"check-finally",
So I can force
if () {
}
else {
}
I'm currently using [email protected]. How can I set this up?
Upvotes: 4
Views: 1948
Reputation: 994
There is tslint-eslint-rules packege, which makes possible to run (some) of the eslint rules in tslint. Luckily, the brace-style rule is implemented and your brace-style can be enforced by:
"brace-style": ["error", "stroustrup"]
(I didn't tried it, it is possible that it requires some tweaking)
Upvotes: 0
Reputation: 276393
How to configure TSLint one-line for some rules and the opposite for others?
You basically want a rule like multiline
for catch
/else
/finally
. Going through : https://github.com/palantir/tslint I don't see such a rule mentioned.
You can request it here : https://github.com/palantir/tslint/issues
Upvotes: 1