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

Possible wrong typescript version detected #528

Closed
luisnaranjo733 opened this issue Oct 19, 2018 · 5 comments
Closed

Possible wrong typescript version detected #528

luisnaranjo733 opened this issue Oct 19, 2018 · 5 comments
Labels

Comments

@luisnaranjo733
Copy link

I'm using this module through madge, which uses the "dependency-tree" package, which uses the "precinct" package, which uses the "detective-typescript" package, which actually has "typescript-eslint-parser" as a dependency.

I am seeing the following warning, which I suspect is incorrect

WARNING: You are currently running a version of TypeScript which is not officially supported by typescript-eslint-parser.

You may find that it works just fine, or you may not.

SUPPORTED TYPESCRIPT VERSIONS: ~3.0.1

YOUR TYPESCRIPT VERSION: 3.1.3 

My project's devDependencies in package.json looks like this
"typescript": "^3.0.1",
and if I go to node_modules/typescript/package.json, I can see
"version": "3.0.1".
So basically I'm pretty sure that I'm on 3.0.1, but typescript-eslint-parser is warning me that I'm on the wrong version.

Any idea why this might be happening?

@kaicataldo
Copy link
Member

kaicataldo commented Oct 19, 2018

It sounds like you're running ESLint on your node_modules/ directory, which I'd strongly encourage you to not do! node_modules are ignored by default - are you linting them for a specific purpose?

Sorry - realizing I misunderstood. I thought this was being run in a linting step. It sounds like it might be pulling in a sub-dependency typescript module. Any chance you can check to see if that's the case?

@luisnaranjo733
Copy link
Author

luisnaranjo733 commented Oct 22, 2018

Yeah, you're right. I just noticed that my yarn.lock has two top level entries for TS, and that detective-typescript references 3.0.3. So that is getting used instead of the version I'm declaring. Is this considered a bug in detective-typescript?

typescript@^3.0.1:
  version "3.0.1"

typescript@^3.0.3:
  version "3.1.3"

detective-typescript@^4.0.0:
  version "4.1.1"
  dependencies:
    node-source-walk "^4.0.0"
    typescript "^3.0.3"
    typescript-eslint-parser "^18.0.0"

@kaicataldo
Copy link
Member

detective-typescript might be able to mitigate these errors by matching the version of TS specified exactly (i.e. ~3.0.1 should fix this, I believe), but that would most likely require changing the version of typescript-eslint-parser so that it doesn't update semver-minor versions automatically either. It's tricky with a project like this because changes in parsers are almost always breaking changes.

@kaicataldo
Copy link
Member

That being said, now that the bulk of parsing is being done in typescript-estree, I imagine most non-ESLint dependencies would want to use that package directly.

@JamesHenry
Copy link
Member

I think this issue was resolved, but feel free to open a new issue on the new project https://github.com/typescript-eslint/typescript-eslint at any time

Thanks!

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

3 participants