Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add support for arrow functions #952

Closed
valueof opened this Issue · 8 comments

5 participants

@valueof
Owner

ES6 implements arrow functions that look something like this:

function test() {
  return x () => { ... };
}

One major browser (Firefox) had already shipped support for this type of functions and, since they're officially in ES6, we also need to support them under the esnext flag.

What needs to be done

JSHint should correctly parse arrow functions (as per spec) keeping in mind the new scope, etc.

There's bounty on this bug

You can get paid to fix this bug! See our page on BountySource for more info.

@rwaldron
Owner

+1

@guyzmo guyzmo referenced this issue
Merged

fixes #952 #971

@guyzmo

done

@valueof
Owner

Landed!

@valueof valueof closed this
@mzgol

@antonkovalyov I don't see it... Using the jsHint 2.3.0 the following code:

const g = x => x * x;

produces an error:

'x' is not defined

And yes, I have esnext turned on and it shows since jsHint doesn't complain about const here.

@valueof
Owner

This is a known bug with our arrow function support which I intend to fix very soon.

@mzgol

@antonkovalyov Got it. What works, then? i tried wrapping 'x' in params and it didn't help.

Btw, I believe your example from the initial post is incorrect, arrow functions cannot be named in this way.

EDIT: oh well, it seems arrow functions can be named. I wonder why I haven't seen any examples of that before.

@Mithgol

@mzgol Fixed in #1363, I presume.

@mzgol

@Mithgol Yes, it's fixed now. :) Thanks, @antonkovalyov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.