You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created .eslintrc.js file with the content given in README.md.
I run: yarn eslint . --ext .js,.jsx,.ts,.tsx
The result was:
Oops! Something went wrong! :(
ESLint: 7.0.0
Error: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.js': Cannot find module 'typescript'
Require stack:
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\typeguard\2.8\node.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\typeguard\2.9\node.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\typeguard\3.0\node.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\typeguard\3.2\node.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\typeguard\node.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\typeguard\index.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\index.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\@typescript-eslint\eslint-plugin\dist\util\isTypeReadonly.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\@typescript-eslint\eslint-plugin\dist\util\index.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\@typescript-eslint\eslint-plugin\dist\rules\adjacent-overload-signatures.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\@typescript-eslint\eslint-plugin\dist\rules\index.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\@typescript-eslint\eslint-plugin\dist\index.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\eslint\lib\cli-engine\config-array-factory.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\eslint\lib\cli-engine\cascading-config-array-factory.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\eslint\lib\cli-engine\cli-engine.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\eslint\lib\eslint\eslint.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\eslint\lib\eslint\index.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\eslint\lib\cli.js
- C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\eslint\bin\eslint.js
Referenced from: C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\.eslintrc.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
at Function.Module._load (internal/modules/cjs/loader.js:677:27)
at Module.require (internal/modules/cjs/loader.js:830:19)
at require (C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\v8-compile-cache\v8-compile-cache.js:161:20)
at Object.<anonymous> (C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\tsutils\typeguard\2.8\node.js:3:12)
at Module._compile (C:\Users\Darek\Documents\Inne\Notatki\1.Programowanie\2.6.JavaScript\Browser\iw-components\node_modules\v8-compile-cache\v8-compile-cache.js:194:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32)
at Function.Module._load (internal/modules/cjs/loader.js:703:12)
at Module.require (internal/modules/cjs/loader.js:830:19)
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I uninstalled global TypeScript by npm uninstall - g typescript, then installed it locally by npm install typescript, and finally I performed the above mentioned steps 1, 2 and 3. Now ESlint works.
Unfortunately I have not found information that TypeScript should not be installed globally. If this is really the case, then please add this information to README.md.
The text was updated successfully, but these errors were encountered:
I believe you're making the incorrect assumption about the npm ecosystem.
You should assume that a tool will not work with global installs unless specifically stated in the readme.
Global installs often require extra work from the package author to support properly.
Particularly in the case of requiring dependencies in a global package space vs a local package space - a package author needs to specifically and consciously setup their requires such that they check both the local and global spaces, which almost no packages do.
You must install our tooling and all of the required dependencies locally for it to work.
We do not support global typescript installs, and likely never will.
I made a pull request #2043 to add information about this to FAQ.md. I added a justification why the information can be important. I am a new npm user, so maybe only I have such problems. In this case, feel free to delete the pull request.
Several months ago I installed TypeScript globally by running: npm install - g typescript
Today I made steps described on https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md i.e.:
yarn add -D eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin
The result was:
I created .eslintrc.js file with the content given in README.md.
I run:
yarn eslint . --ext .js,.jsx,.ts,.tsx
The result was:
I uninstalled global TypeScript by
npm uninstall - g typescript
, then installed it locally bynpm install typescript
, and finally I performed the above mentioned steps 1, 2 and 3. Now ESlint works.Unfortunately I have not found information that TypeScript should not be installed globally. If this is really the case, then please add this information to README.md.
The text was updated successfully, but these errors were encountered: