This would be the minimal change you need. I recommend adding the ()
for the function call, but this rule doesn't care about those.
$ ->
$("#selector").dialog {
modal: true
}
modal: true
is implied to be an object. To demonstrate why this rule is good to have enabled, lets say you had some very similar code that accepts a parameter.
makeDialog = (foo) ->
$("#selector").dialog
modal: true,
foo: foo,
This code looks fine, it even compiles correctly. But at some point you notice that foo: foo
can be simplified.
makeDialog = (foo) ->
$("#selector").dialog
modal: true,
foo,
Now your code is broken. CoffeeScript correctly guessed that modal: true
is a property on an implied object that is the first parameter of dialog
, but it doesn't know if foo
is a 2nd property on that object or a 2nd parameter to the function. It ends up compiling out to this:
return $("#selector").dialog({ modal: true }, foo);