In general write
Declare functions like this:
function_name = (arg1, opts) -> ...
function_with_no_args = -> ...
function_in_component: (arg1, arg2, opts) -> ...
Notice that functions which behave as members to a class should have the colon directly after the name.
Do not declare them like this:
badFunction : (arg1, arg2, arg3, arg4) ->
Functions should have a maximum of 3 arguments. Typically no more than 2. For more arguments, use the
In general, if you ever find yourself wanting to use a default value for an argument, it's probably time to use
->? This has to do with scoping context at call time. There is (usually) a right answer.
We have (no?) stance on single quotes vs double quotes. However, do note that string interpolation in coffeescript only works using double quotes. ie.
For very long strings, use string concatenation to split it over long lines
Also, notice the break before the operator.
which also dedents the lines such that the string is actually ending up to be
[hsy]> how to comment functions, methods, ... ?