jambit / eslint-plugin-typed-redux-saga

These are eslint rules to help with typed-redux-saga
MIT License
17 stars 3 forks source link

TypeError: Cannot read property 'type' of undefined #1

Closed mnn closed 3 years ago

mnn commented 4 years ago
> eslint --ext .ts,.tsx src --report-unused-disable-directives

Oops! Something went wrong! :(

ESLint: 7.12.1

TypeError: Cannot read property 'type' of undefined
Occurred while linting /xxx/src/modules/administration/sagas/yyy.ts:41
    at getCalleeKey (/xxx/node_modules/@jambit/eslint-plugin-typed-redux-saga/rules/delegate-effects.js:31:27)
    at YieldExpression (/xxx/node_modules/@jambit/eslint-plugin-typed-redux-saga/rules/delegate-effects.js:48:50)
    at /xxx/node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (/xxx/node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (/xxx/node_modules/eslint/lib/linter/node-event-generator.js:254:26)
    at NodeEventGenerator.applySelectors (/xxx/node_modules/eslint/lib/linter/node-event-generator.js:283:22)
    at NodeEventGenerator.enterNode (/xxx/node_modules/eslint/lib/linter/node-event-generator.js:297:14)
    at CodePathAnalyzer.enterNode (/xxx/node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:711:23)
    at /xxx/node_modules/eslint/lib/linter/linter.js:952:32

relevant code (compiles and works fine):

    yield isOkResponse(response) // line 41
        ? call(handleSuccessResponse, response)
        : call(handleErrorResponse, response);

^it's in a generator. handleSuccessResponse and handleErrorResponse are generators as well.

rodrigofariow commented 3 years ago

Hi @SantoJambit!

First of all, great eslint plugin and very useful I may say!

I was just about to convert our long existing project in my company to using typed-redux-saga and this plugin is, in my opinion, a very important part of it. Without it, we can have real runtime issues as you are probably aware.

Having said that, I was wondering if you are still using this on your projects and if you've encountered the issue described above? From what I've tested this is the only issue that I encountered with it.

Thank you for your time! 💯

SantoJambit commented 3 years ago

Sorry about the delay. I never got any emails for this project, possibly, because It wasn't starred? I only noticed because I was mentioned. Thanks @rodrigofariow!

On the topic: I am quite busy today, but I'll try to find some time to investigate this at the very least in the next couple of days.

rodrigofariow commented 3 years ago

Thanks for the quick response @SantoJambit ! I'm glad I pinged you :D

And thanks for dedicating some time to this ;)

Cheers!

SantoJambit commented 3 years ago

I've published a fix. 0.2.0 should work for you now. Give it a try and reopen if this doesn't work. Thanks for the report!

mnn commented 3 years ago

Thank you, it works like a charm with latest version :slightly_smiling_face:.