Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Error while checking incomplete code #349

Closed
jskorepa opened this issue Aug 12, 2017 · 3 comments
Closed

Error while checking incomplete code #349

jskorepa opened this issue Aug 12, 2017 · 3 comments

Comments

@jskorepa
Copy link

What version of TypeScript are you using?
2.4.2

What version of typescript-eslint-parser are you using?
5.0.1

What code were you trying to parse?

export class Klass {
  method2()
}

What did you expect to happen?
To report problem, but not throw unhandled Error

What happened?

$ ./node_modules/.bin/eslint --parser typescript-eslint-parser source.ts
Cannot read property 'type' of null
TypeError: Cannot read property 'type' of null
    at Linter.onCodePathStart (/home/jakub.skorepa/Dokumenty/html/workstream_node/backend/node_modules/eslint/lib/rules/array-callback-return.js:193:34)
    at emitTwo (events.js:130:20)
    at Linter.emit (events.js:213:7)
    at processCodePathToEnter (/home/jakub.skorepa/Dokumenty/html/workstream_node/backend/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:357:30)
    at CodePathAnalyzer.enterNode (/home/jakub.skorepa/Dokumenty/html/workstream_node/backend/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:599:9)
    at Traverser.enter (/home/jakub.skorepa/Dokumenty/html/workstream_node/backend/node_modules/eslint/lib/linter.js:925:36)
    at Traverser.__execute (/home/jakub.skorepa/Dokumenty/html/workstream_node/backend/node_modules/estraverse/estraverse.js:397:31)
    at Traverser.traverse (/home/jakub.skorepa/Dokumenty/html/workstream_node/backend/node_modules/estraverse/estraverse.js:501:28)
    at Traverser.traverse (/home/jakub.skorepa/Dokumenty/html/workstream_node/backend/node_modules/eslint/lib/util/traverser.js:31:22)

It is really annoying if check-as-you-type is enabled in atom.
image

@JamesHenry
Copy link
Member

Thanks so much for your patience on this, @jskorepa!

I am not an Atom user myself, are you saying this behaviour is different to standard ESLint usage? i.e. when it is using a parser other than typescript-eslint-parser

Would you mind also checking if the behaviour is still reproducible using the latest version of this parser and the supported stable TypeScript version (currently 2.5.3)

@j-f1
Copy link
Contributor

j-f1 commented Oct 22, 2017

are you saying this behaviour is different to standard ESLint usage

Typically, linter-eslint will tell you that there’s a syntax error in your code, without throwing an error:

screen shot 2017-10-22 at 11 21 20

I’m able to reproduce this with the atom-ide-ui and linter-eslint:

screen shot 2017-10-22 at 11 26 22

The error stack looks to be similar to the one provided above. The culprit appears to be that method2() is interpreted as an overload, making this a duplicate of #389.

@JamesHenry
Copy link
Member

Ah, brilliant thanks @j-f1! That indeed confirms this is actually a duplicate of #389, it's just manifesting in a different context.

I will close this one in order to focus all attention in one place.

Thanks again @jskorepa, please follow along with the progress of #389.

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

No branches or pull requests

4 participants