A truly great & short book on CoffeeScript http://arcturo.github.io/library/coffeescript/index.html
I would propose these exceptions to https://github.com/polarmobile/coffeescript-style-guide:
- we can use a max line length of 100
- we can also use @todo(user) for annotation
- we can use alignment for readability
- we use double quotes everywhere
- we try to avoid
if foo
at the end of lines - we use a final
return x
vs just plainx
- one newline after every early
return
- one newline before every final
return
- one newline before every
if
statement (unless at the top of a function) - we void concatenation where possible using
"Hi #{var}"
. Unless in the example of functions. e.g.:"#{parts[0].substr(01)}/#{file}"
For files:
- Classes get their own file
- This means you can
modules.export = ClassName
vsmodules.export.ClassName = ClassName
- any file containing a class will be named
CamelCase.coffee
- classes their tests will be named
testCamelCase.coffee
- all other files be
lower-case-dashed.coffee