Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[no-floating-promises] TypeError: Cannot read property 'kind' of undefined #815

Closed
glen-84 opened this issue Aug 7, 2019 · 3 comments
Closed
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin

Comments

@glen-84
Copy link
Contributor

glen-84 commented Aug 7, 2019

Repro

{
  "rules": {
    "@typescript-eslint/no-floating-promises": "error",
  }
}
let team1score = 0;

team1score++;

Expected Result

No error.

Actual Result

[Error - 09:30:32] TypeError: Cannot read property 'kind' of undefined
Occurred while linting D:\Programming\Projects\...\src\app\test.ts:3
    at isUnhandledPromise (D:\Programming\Projects\...\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-floating-promises.js:47:28)
    at ExpressionStatement (D:\Programming\Projects\...\node_modules\@typescript-eslint\eslint-plugin\dist\rules\no-floating-promises.js:34:21)
    at listeners.(anonymous function).forEach.listener (d:\Programming\Projects\...\node_modules\eslint\lib\linter\safe-emitter.js:45:58)
    at Array.forEach (<anonymous>)
    at Object.emit (d:\Programming\Projects\...\node_modules\eslint\lib\linter\safe-emitter.js:45:38)
    at NodeEventGenerator.applySelector (d:\Programming\Projects\...\node_modules\eslint\lib\linter\node-event-generator.js:253:26)
    at NodeEventGenerator.applySelectors (d:\Programming\Projects\...\node_modules\eslint\lib\linter\node-event-generator.js:282:22)
    at NodeEventGenerator.enterNode (d:\Programming\Projects\...\node_modules\eslint\lib\linter\node-event-generator.js:296:14)
    at CodePathAnalyzer.enterNode (d:\Programming\Projects\...\node_modules\eslint\lib\linter\code-path-analysis\code-path-analyzer.js:645:23)
    at nodeQueue.forEach.traversalInfo (d:\Programming\Projects\...\node_modules\eslint\lib\linter\linter.js:885:32)

Additional Info

(Let me know if the stack trace above is insufficient.)

Versions

package version
@typescript-eslint/eslint-plugin 1.13.0
@typescript-eslint/parser 1.13.0
TypeScript 3.4.5
ESLint 6.1.0
node 10.16.0
npm 6.9.0
@glen-84 glen-84 added package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin triage Waiting for maintainers to take a look labels Aug 7, 2019
@bradzacher bradzacher added bug Something isn't working and removed triage Waiting for maintainers to take a look labels Aug 7, 2019
@bradzacher
Copy link
Member

seems like a misunderstanding ts.isBinaryExpression - returns true for PostfixUnaryExpression

@raymondfeng
Copy link

We're running into the same issue with TypeScript 3.7.2.

@bradzacher
Copy link
Member

I'm unable to repro this against master:

 PASS  tests/rules/no-floating-promises.test.ts (5.107s)
  no-floating-promises
    valid
      ✓ 
let team1score = 0;
team1score++;
     (1150ms)

Looking at your versions - you're on a v old version of the plugin.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: eslint-plugin Issues related to @typescript-eslint/eslint-plugin
Projects
None yet
Development

No branches or pull requests

3 participants