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

TypeScript dependency? #339

Closed
topaxi opened this issue Jul 22, 2019 · 8 comments
Closed

TypeScript dependency? #339

topaxi opened this issue Jul 22, 2019 · 8 comments
Labels

Comments

@topaxi
Copy link

topaxi commented Jul 22, 2019

Does this plugin need typescript installed? There is no mention in the README, yet our setup crashes with Cannot find module 'typescript' once we installed this plugin.

@aknorw
Copy link

aknorw commented Jul 22, 2019

I have the same issue, described here: #338 (comment)

@duncan-thacker
Copy link

Same problem here, using a non-typescript project. I get

Error: Failed to load plugin 'jest' declared in '.eslintrc.json': Cannot find module 'typescript'

Referenced from: ...\demo-loader.eslintrc.json
at Function.Module._resolveFilename (module.js:538:15)
at Function.Module._load (module.js:468:25)
at Module.require (module.js:587:17)
at require (...\demo-loader\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object. (...\demo-loader\node_modules@typescript-eslint\typescript-estree\dist\parser.js:17:25)
at Module._compile (...\demo-loader\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)

Reverting to 22.13.0 fixes the problem.

@SimenB
Copy link
Member

SimenB commented Jul 22, 2019

Bah, I thought this was fixed (typescript-eslint/typescript-eslint#584)... Should have verified manually, sorry! As a quickfix I'll add typescript as a dependency.

/cc @bradzacher

@SimenB SimenB closed this as completed in f64441b Jul 22, 2019
@SimenB
Copy link
Member

SimenB commented Jul 22, 2019

🎉 This issue has been resolved in version 22.13.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@bradzacher
Copy link
Contributor

import { AST_NODE_TYPES, TSESTree } from '@typescript-eslint/typescript-estree';

VSCode's auto-import got you!

typescript will happily auto-import @typescript-eslint/typescript-estree, even if it's a transient dependency.
This would normally be fine, but typescript-estree's index.js has a hard import on typescript.
typescript-eslint/typescript-eslint#584 worked around this by deeplinking past the entry point.

I'd suggest using the import/no-extraneous-dependencies rule, as it'll make sure that modules exist in package.json

@SimenB
Copy link
Member

SimenB commented Jul 22, 2019

Yeah, I just noticed when trying to create a bug report for you 😅 Yup, I was gonna add that rule when I noticed the error. Thanks!

@SimenB
Copy link
Member

SimenB commented Jul 22, 2019

Pushed 7f1867b

@pponugo
Copy link

pponugo commented Oct 19, 2022

Is this fix broken again? Looks like TypeScript is again required in version 27

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

No branches or pull requests

6 participants