vscode-eslint: pnpm, eslint & typescript - Error: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.js
In my project, using pnpm, Node v14.6.0, Eslint 7.23.0 and the plugin’s latest version, I get this error:
Error: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.js
Unfortunately, I cannot share the project itself to allow for easy reproduction. I went through all the relevant issues and tried the suggestions without any luck.
In the dir in which I open code
, I successfully run which pnpm
(I saw this was referenced in another issue), and also running from the terminal pnpm run eslint
is successful.
I set my Workspace Settings for the plugin to use pnpm
as the package manager.
Any advice on how I can debug this further?
It might be worth noting that the .eslintrc.js
in question is not the one in my project, but rather one referenced from one of my dependencies, which my .eslintrc.js
extends.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 6
- Comments: 16 (6 by maintainers)
came across this while migrating a repo I work on to pnpm. I had to one by one hoist as described here. happy to repro if we want to dive back in.
I have: pnpm 7.1.5 a mono repo: app1
app2
shared-eslint-config
and from terminal eslint works fine without hoisting, but I added this:
in my .npmrc file.
and that cleared it up for me.
I tried various settings as well from other similarly reported issues:
settings.json:
without hoisting I get this:
still not solved for me. i’m using
eslint-config-airbnb-typescript
which uses@typescript-eslint/eslint-plugin
as peers, I setauto-install-peers=true
in.npmrc
. But @typescript-eslint/eslint-plugin not added to node_modules, even though it’s listed inpnpm-lock.yaml
I found that the issue has to do with
public-hoist-pattern[]
I have defined in my .npmrc. Does this give any relevant clues that could help? My issue with creating a reproducible repo is that most of the packages used by the project are private. The reason for thepublic-hoist-pattern
is that this is how the project runs in my CI environment which I don’t have control over, and I want to run my local project in an environment as close as possible to CI.I will give another try to creating a reproducible repo over the weekend but really hoping that this will give some clues. Thanks a lot for your help.