Largely inspired by Airbnb's JavaScript style guide
4 spaces.. not 2, no tabs
Array of dependencies are line-delimited.
# good
require [
'foo'
'bar'
'qux'
], (foo, bar, qux) ->
# bad
require ['foo', 'bar', 'baz'], (foo, bar, baz) ->
No trailing commas for line-delimited arrays or objects.
# good
foo = [
'foo'
'bar'
'baz'
]
bar =
foo: 1
bar: 2
baz: 3
# bad
foo = [
'foo',
'bar',
'baz'
]
bar =
foo: 1,
bar: 2,
baz: 3
Single quotes always, unless a single quote is used in the string itself
# good
foo = 'hello'
bar = "can't"
# bad
foo = "bar"
bar = 'can\'t'
No parenthesis with arguments that span multiple lines.
# good
foo = new Foo
bar: 1
qux: false
foo = bar
bar: 1
qux: false
# bad
foo = new Foo(
bar: 1
qux; false
)
foo = bar(
bar: 1
qux: false
)