no_private_function_fat_arrows rule doesn't seem right
Closed this issue · 1 comments
Moved from #444 (comment):
I use a little helper for convenient getter/setter syntax, and it seems a fat arrow is needed.
class Test
# With a fat arrow, `@` inside evaluates to the class:
get1 = (props) =>
console.log @
# Without a fat arrow, `@` inside evaluates to just `this`:
get2 = (props) ->
console.log @
# But either way, calling these helpers does nothing special with `this`,
# hence it'll be "lost" in the second case:
get1 foo: -> bar
get2 foo: -> baz
cc @mitar
I don't think the code is any deeper than, 'is there a fat arrow in front of a function in a class?'. There's not much deep static analysis determining whether something later on gets called internally/privately.
It does seems like fat arrows in local/private functions should be valid as it returns the class/object rather than this
, so maybe the rule should have been sussed out better.
That said, I suppose you should just turn this off in your case, or directly call it as URL::
. If I'm interpreting this issue wrong feel free to point that out. Otherwise I'm not sure what else can be done to fix this.