Closed tarruda closed 10 years ago
I'm not seeing where your description lines up with the subject "Split 'implicit parens/braces' into two rules". no_implicit_parens
and no_implicit_braces
are already different rules.
Am I understanding correctly that you're asking for multi-line statements to have one set of rules and single-line statements to gave the opposite rule? If I'm understanding correctly I think that would make this by far the most complex rule in all of CoffeeLint.
I tought about adding four extra rules:
no_implicit_multiline_parens
no_implicit_singleline_parens
no_implicit_multiline_braces
no_implicit_singleline_braces
These rules would override no_implicit_parens
and no_implicit_braces
for when the expression is spread over one line/multiple lines. This would allow the programmer to selectively enforce explicit parenthesis/braces
I'm not a huge fan. The purpose of these rules is to completely eliminate potentially ambiguous syntax, not eliminate it under certain circumstances.
These potentially could be an option in each rule, but definitely shouldn't be a rule in and of itself.
@clutchski I was not aware that coffeelint support rule-specific options, if so then I also think those should be options within the existing rules
So, was there a way to do this? I'm not a huge fan of the apparent flip-flopyness, but I can sympathize with those who think single line compositions can get a little confusing without parens.
Yes, it's possible to add options to the rules. Someone with an interest in using the rule just needs to get it done.
I currently use the following coding style for function/method calls:
Same for object literals:
I think identation makes pretty clear when the function call/object literal ends so I only use braces when everything is in the same line and can lead to confusion.
Maybe coffeelint should support this style?