eslint-config-auto
eslint-config-auto copied to clipboard
Doesn't work in VS Code when project is in a subfolder
Hello, I tried this plugin. It works in the terminal, but it crashes in VS Code.
The error:
Uncaught exception received.
TypeError: Cannot read config file: projectPath/node_modules/eslint-config-auto/index.js
Error: Cannot destructure property 'packageJson' of 'readPkgUp.sync(...)' as it is undefined.
Referenced from: projectPath/.eslintrc.json
at Object.<anonymous> (projectPath/node_modules/eslint-config-adjunct/lib/utils.js:12:22)
at Module._compile (node:internal/modules/cjs/loader:1163:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1216:10)
at Module.load (node:internal/modules/cjs/loader:1035:32)
at Module._load (node:internal/modules/cjs/loader:876:12)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Module.require (node:internal/modules/cjs/loader:1059:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (projectPath/node_modules/eslint-config-adjunct/configs.js:1:23)
at Module._compile (node:internal/modules/cjs/loader:1163:14)
This is my config:
{
"extends": [
"auto"
]
}
And these are the used packages:
Looks like an issue in a dependency, can you delete node_modules and reinstall
@davidjbradshaw that didn't help. It looks that the error is in this snippet here in eslint-config-auto/lib/utilsjs:

I think I solved the problem. The problem was that our next app was in a subdirectory. VS Code eslint was running in the top directory, so it couldn't find the package.json.
The solution is to add this to .vscode/settings.json (client is the subfolder where eslint should run).
{
"eslint.workingDirectories": [
"./client"
]
}
Glad you worked it out. It would be great if you could add that tip to the docs-- Sent from my iPhone.