Description
We are using PNPM as a package manager and recently the ESLint VSCode extension stopped working in our repo with the following messages:
[Info - 6:16:51 PM] ESLint server is starting.
[Info - 6:16:51 PM] ESLint server running in node v22.14.0
[Info - 6:16:51 PM] ESLint server is running.
[Info - 6:16:52 PM] Server process exited successfully
[Info - 6:16:53 PM] ESLint library loaded from: C:\shopify\loyalty-program-shopify\node_modules.pnpm\eslint@8.57.1\node_modules\eslint\lib\api.js
[Error - 6:16:55 PM]
Failed to load plugin 'react-hooks' declared in '.eslintrc.json » eslint-config-airbnb/hooks » C:\shopify\loyalty-program-shopify\node_modules.pnpm\eslint-config-airbnb@19.0.4_92edc6589d0da743fbf0632d9f1d5a8d\node_modules\eslint-config-airbnb\rules\react-hooks.js': Cannot find module 'eslint-plugin-react-hooks'
Require stack:
- C:\shopify\loyalty-program-shopify_placeholder_.js
Happened while validating C:\shopify\loyalty-program-shopify\app\routes\auth.login\route.jsx
This can happen for a couple of reasons:
- The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc).
- If ESLint is installed globally, then make sure 'eslint-plugin-react-hooks' is installed globally as well.
- If ESLint is installed locally, then 'eslint-plugin-react-hooks' isn't installed correctly.
Consider running eslint --debug C:\shopify\loyalty-program-shopify\app\routes\auth.login\route.jsx from a terminal to obtain a trace about the configuration files used.
Note that the plugin ESLint is looking for are peer dependencies and are automatically installed by PNPM.
At the same time, the pnpm eslint .
command works as expected from the command line.
A temporary workaround is adding these dependencies to package.json
, but it's somewhat redundant and is cluttering the list of dependencies that are directly used by the repo. Additionally, it would be good if running ESLint from the extension would have a similar behavior to it running from the command line.