Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work in VS Code when project is in a subfolder #50

Open
julius-retzer opened this issue Jun 17, 2022 · 4 comments
Open

Doesn't work in VS Code when project is in a subfolder #50

julius-retzer opened this issue Jun 17, 2022 · 4 comments

Comments

@julius-retzer
Copy link
Contributor

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:

image

@davidjbradshaw
Copy link
Owner

Looks like an issue in a dependency, can you delete node_modules and reinstall

@julius-retzer
Copy link
Contributor Author

@davidjbradshaw that didn't help. It looks that the error is in this snippet here in eslint-config-auto/lib/utilsjs:
image

@julius-retzer
Copy link
Contributor Author

julius-retzer commented Jun 22, 2022

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"
    ]
}

@julius-retzer julius-retzer changed the title Doesn't work in VS Code Doesn't work in VS Code when project is in a subfolder Jun 22, 2022
@davidjbradshaw
Copy link
Owner

davidjbradshaw commented Jun 22, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants