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

Parse error when using as parser for eslint-plugin-import #519

Closed
christophercurrie opened this issue Sep 26, 2018 · 4 comments
Closed

Parse error when using as parser for eslint-plugin-import #519

christophercurrie opened this issue Sep 26, 2018 · 4 comments
Labels

Comments

@christophercurrie
Copy link

christophercurrie commented Sep 26, 2018

What version of TypeScript are you using?

3.0.1

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

19.0.1

What code were you trying to parse?

import Foo from "./Foo";

What did you expect to happen?

Using eslint-plugin-import 2.14.0 should allow eslint on Javascript to check imports of Typescript files using typescript-eslint-parser as documented by the plugin.

What happened?

All files importing typescript code complain:

Parse errors in imported module './Foo': parser.parse is not a function. (undefined:undefined)

It appears that version 19 has dropped the parse function from its list of exports, which seems like it would be related.

@platinumazure
Copy link
Member

Seems that eslint-plugin-import should follow the same rules as ESLint when parsing a file: it should check for a parseForESLint method and use that (and get the AST from the output), else fall back to parse.

Not sure if we want/need to add parse back to the exports as a short-term fix in the meanwhile.

@JamesHenry
Copy link
Member

I think both approaches would be reasonable. 19 was a breaking change version and this was a breaking change, so there shouldn't be an issue for folks rolling back. On the other hand, it would be trivial to add for backwards compatibility and we could accept a PR?

@GabeDuarteM
Copy link

I'm having this as well, and this is kind of preventing me from upgrading to the latest, you can see the error here https://travis-ci.com/GabrielDuarteM/gd-scripts/jobs/147824652#L4114

I'm not familiar with the codebase/eslint internals, and the error is kind of cryptic, as apparently this is not really an error in my code (at least I hope), so I didn't quite understand what is going on.
Is this an error that should be fixed by eslint-plugin-import (I am using that as well)?

@dashmug
Copy link

dashmug commented Sep 27, 2018

I'm getting the same error as well.

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

No branches or pull requests

5 participants