-
Notifications
You must be signed in to change notification settings - Fork 887
Complement to [one-line]? #88
Comments
|
One more thing: If we start having rule complements, we now have to handle invalid configurations. Right now, rules are mutually exclusive and that makes things a lot simpler. I'm cautious to introduce dependencies across rules (e.g. both |
It doesn't necessarily have to be 'complement'. The arguments for this style are that the closing brace enforces a natural blank line-end. More importantly the (highlighted) keyword is now on the left edge of the code blocks, very visible, in same way as many other statements ( This is a very common style in any bracy language so I think it should work in the standard rules. |
Even then, a configuration with both |
Yes, they conflict, they should probably be options of one single rule (the name Maybe call it something with 'wrapping & braces' like in WebStorm? I have no specific preference to how it is implemented or named though. |
Is there any news on this? I would really like to enforce if/else etc on the next line. This is a very old issue, do you have a solution for your rule-conflict situation? (ie: Maybe it should be possible to enable them at the same time. Then you can do something like "one-line": [
true,
"check-open-brace",
"check-else",
"check-whitespace"
],
"next-line": [
true,
"check-finally",
"check-catch"
] Why one would want this, don't ask me.. But it's always nice to find a use-case to unwanted behaviour ;-) Just let the last definition of |
I am/was considering using a PHP PSR-2 style, where classes, interfaces, and methods have the brace on a new line, and if/else/try/catch/etc. have it on the same line. Simple example: class Example
{
public method(): void
{
if (true) {
// ...
} else {
// ...
}
}
} I think it looks neat, albeit not so common in the JS/TS world. It might make sense to support this as well (i.e. allow each brace position to be specified individually). |
I also prefer using next-line for
Basically, I want to force open braces to be on the previous line, and close braces to be on a new line.
Instead, I would want to force the above like this:
It makes it way more readable in my opinion. |
Closing this issue per #4534. Thanks for the discussion, folks! |
Is it possible to enforce this style of having some blocks on the next line from the expression preceding them? Like the reverse of [one-line]
The text was updated successfully, but these errors were encountered: