Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Description
This issue is with regards to the package@typescript-eslint/typescript-estree.
The compiled version of parser.js contains this line:
constts=__importStar(require("typescript"));// leave this as * as ts so people using util package don't need syntheticDefaultImports
If TypeScript isn't present, the package cannot be used.
In my case, I have an eslint plugin that use this package under the hood. The plugin fails to load if TypeScript isn't present (i.e. the plugin is being used to lint a project that doesn't use TypeScript).
$ /path/to/project/node_modules/.bin/eslint.Error: Failed to load plugin'someplugin' declaredin'.eslintrc': Cannot find module'typescript'Require stack:- /path/to/project/node_modules/@typescript-eslint/typescript-estree/dist/parser.js- /path/to/project/node_modules/eslint-plugin-someplugin/lib/index.js- /path/to/project/node_modules/eslint/lib/cli-engine/config-array-factory.js- /path/to/project/node_modules/eslint/lib/cli-engine/cascading-config-array-factory.js- /path/to/project/node_modules/eslint/lib/cli-engine/cli-engine.js- /path/to/project/node_modules/eslint/lib/cli-engine/index.js- /path/to/project/node_modules/eslint/lib/cli.js- /path/to/project/node_modules/eslint/bin/eslint.jsReferenced from: /path/to/project/.eslintrc at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15) at Function.Module._load (internal/modules/cjs/loader.js:527:27) at Module.require (internal/modules/cjs/loader.js:681:19) at require (/path/to/project/node_modules/v8-compile-cache/v8-compile-cache.js:161:20) at Object.<anonymous> (/path/to/project/node_modules/@typescript-eslint/typescript-estree/dist/parser.js:17:25) at Module._compile (/path/to/project/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10) at Module.load (internal/modules/cjs/loader.js:641:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Module.require (internal/modules/cjs/loader.js:681:19)error Command failed withexit code 2.info Visit https://yarnpkg.com/en/docs/cli/runfor documentation about this command.
I believe the solution to this issue would be to have @typescript-eslint/typescript-estree declare TypeScript as either a dependency or a peerDependency.