-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Add jscs rule requireCurlyBraces and disallowKeywordsOnNewLine #10865
Conversation
This is in preperation for adding the jscs rule "requireCurlyBraces"
…containing return, break, or throw This is in preperation for adding the jscs rule "requireCurlyBraces"
Add curly braces to single line control flow statements
i think we should stop adding new style rules to enforce :| this is getting too restrictive |
I am ok with these changes, but I am ok with what the majority thinks is best |
I was thinking maybe we remove the remaining Although they should be for the most part pretty good - I tried opposite rules to see how much more percentage a style was being used. |
I would be quite keen to clean out the cases where we have an But we generally accept in our code base that a simple And so I don't think we can land this PR. Sorry @rzschech. Thank you for looking into it. |
There is an issue for an exception to allow single statements (like returns) so maybe in the future jscs-dev/node-jscs#244 |
@hzoo - yes, I think we are about there on the JSCS rules for now. |
@rzschech - I did land the first commit though, since I like that style even if it is not enforceable right now. |
@petebacondarwin thanks, I thought this might be contentious hence splitting the pull request into a few commits. |
I split the
requireCurlyBraces
changes into three commits to make it easer to review the code. They are also ordered from the least contentious (adding curly braces to statements that are already multiline) to most contentious (single line statements that return, break or throw) which makes the code more verbose.The
disallowKeywordsOnNewLine
changes are unfortunately dependent on therequireCurlyBraces
so can't be done as an independent pull request.