clutchski / coffeelint

Lint your CoffeeScript.
http://www.coffeelint.org
Other
1.18k stars 171 forks source link

Erroneous Fat Arrow Warning when fn is attached to an object #637

Open nickperkinslondon opened 6 years ago

nickperkinslondon commented 6 years ago

Thank-you so much for Coffee-Lint, I love it! Just one small request...

The following code gives the "Fat Arrow" warning for "do_it_twice", but this is incorrect. The function is already bound to the right object. In fact, the fat arrow cannot be used here at all -- it will break the code! The linter should detect that a function is being assigned to an object attribute and not suggest using the fat arrow.


do_it = -> console.log "doing it..."

my_thing = 

    do_it_once:->
        do_it()

    do_it_twice:->
        @do_it_once()
        @do_it_once()

my_thing.do_it_twice()