no_unnecessary_fat_arrows: function contains super
Closed this issue · 6 comments
If you have a function which uses super
, the fat arrow is necessary but the rule tells you to remove it.
Can you explain with some code? I am assuming you are writing inside an instance function (otherwise CS would complain) and AFAIK you don't need fat arrows to call super
.
class A extends B
method: ->
asyncFn ->
super()
method gets compiled to
A.prototype.method = function() {
return asyncFn(function() {
return A.__super__.method.call(this);
});
};
Since this is used, looks like the fat arrow is needed
Yeah seems like a bug. I'm guessing if super is called somewhere you need to make sure fat arrows are propagated back up to the main func. I'm not intimately familiar with this rule/code so it may take me some time to find a solution. PRs accepted.
It might be worth filing an issue in coffeescript to see if this is really the intended behavior. I can't see how that code could ever turn out well without fat arrows
Sorry this is already supported. A team member must have been using an out of date coffeelint
👍 On a related note, there is an issue about this in jashkenas/coffeescript#1606