Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

noFunctionExpressionRule for generators #291

Closed
anvish opened this issue Oct 17, 2016 · 4 comments
Closed

noFunctionExpressionRule for generators #291

anvish opened this issue Oct 17, 2016 · 4 comments

Comments

@anvish
Copy link

anvish commented Oct 17, 2016

noFunctionExpressionRule should not react to function* () { yield 1; } since arrow functions cannot be generators.

@HamletDRC
Copy link
Member

@anvish
I cannot reproduce this.
What version of tslint are you using?
What exactly is your code?

@HamletDRC
Copy link
Member

@anvish also, what version of TypeScript?

As far as I can tell, tslint 3.15.1 hardcordes an ES5 target for the compiler, so I don't see how tslint will even compile this code sample. Is the error really from the rule?

@anvish
Copy link
Author

anvish commented Oct 28, 2016

@HamletDRC
typescript 2.0.3
tslint 3.15.1
sample.tsx:

class A {
    do2(f: any) { }

    do1() {
        return this.do2(function* () { yield 1 })
    }
}

Message: [tslint] Use arrow function instead of function expression
After adding // tslint:disable:no-function-expression the warning disappears

@JoshuaKGoldberg
Copy link

Fixed by #418! 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants