cartant / eslint-plugin-rxjs

ESLint rules for RxJS
MIT License
312 stars 37 forks source link

`no-implicit-any-catch` throws an error #122

Open cerealcable opened 1 year ago

cerealcable commented 1 year ago

When no-implicit-any-catch encounters a catchError statement without any types we end up getting an error. See https://github.com/cartant/eslint-plugin-etc/issues/63 as this happens in this repository as well.

It appears https://github.com/cartant/eslint-etc/pull/12 fixes the problem for us. Hoping we could get a review and merge on that PR? Once I used the contents of that PR it resolved this error for us. We'd like to enable the no-implicit-any-catch rule but need this merged to do so.

sjarva commented 1 year ago

We have a similar situation, but I'd like to add that even with a disabling comment for this no-implicit-any-catch rule, eslint lint process is stopped by an exception/error. This is really inconvenient because we have already enabled this rule and in some cases we have had to use the disabling comment, and now the exception/error breaks our lint, which is one step in our CI/CD. So we had to turn this rule off while we wait for a fix.

merkuriy commented 10 months ago

We have a similar situation. We had to turn this rule off while we wait for a fix.

Example:

of(1).pipe(
    catchError((err) => {
        return of(2);
    }),
);

Log:

TypeError: Cannot read properties of undefined (reading 'typeAnnotation')
Occurred while linting ./src/file.ts:11
Rule: "rxjs/no-implicit-any-catch"
    at checkCallback (./node_modules/eslint-plugin-rxjs/dist/rules/no-implicit-any-catch.js:60:59)
    at CallExpression[callee.name='catchError'] (./node_modules/eslint-plugin-rxjs/dist/rules/no-implicit-any-catch.js:126:17)
    at ruleErrorHandler (./node_modules/eslint/lib/linter/linter.js:1076:28)
    at ./node_modules/eslint/lib/linter/safe-emitter.js:45:58
    at Array.forEach (<anonymous>)
    at Object.emit (./node_modules/eslint/lib/linter/safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (./node_modules/eslint/lib/linter/node-event-generator.js:297:26)
    at NodeEventGenerator.applySelectors (./node_modules/eslint/lib/linter/node-event-generator.js:326:22)
    at NodeEventGenerator.enterNode (./node_modules/eslint/lib/linter/node-event-generator.js:340:14)
    at CodePathAnalyzer.enterNode (./node_modules/eslint/lib/linter/code-path-analysis/code-path-analyzer.js:803:23)