I'm using eslint with flowtype. It was working perfectly until I decided to use es6 generators. When I export a generator, I need to specify the return type but eslint is not recognizing the Generator type.
export function *gen2(): Generator {
yield 'test';
}
Eslint shows this error: 'Generator' is not defined.
but flow works perfectly.
Anyone has any idea on how to make eslint recognize the Generator type?
There is no global Generator
constructor in JS, so ESLint will see that as unknown. You'll need to add it to your .eslintrc
as a global, e.g.
{
"rules": {},
"globals": {
"Generator": true
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With