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

Can not read config file correctly in a subdirectory! #1289

Closed
beginor opened this issue Jul 1, 2021 · 5 comments
Closed

Can not read config file correctly in a subdirectory! #1289

beginor opened this issue Jul 1, 2021 · 5 comments
Labels
info-needed Issue requires more information from poster

Comments

@beginor
Copy link

beginor commented Jul 1, 2021

I have a client folder in my project, which contains all client files like ( node_modules,.eslintrc.json), project structor is

  • client/.eslintrc.json client root eslint config, which loads client/tsconfig.json
  • client/projects/web/.eslintrc.json eslint config for project web , which loads client/projects/web/tsconfig.app.json
  • client/projects/handset/.eslintrc.json eslint config for project handset , which loads client/projects/handset/tsconfig.app.json

when I open file client/projects/web/src/main.ts, I got an error from eslint

Parsing error: Cannot read file '~/net-core-app/projects/web/tsconfig.app.json'. eslint

But the correct path should be ~/net-core-app/client/projects/web/tsconfig.app.json

Screen Shot 2021-07-02 at 07 38 03

And my project is here https://github.com/beginor/net-core-app

@dbaeumer
Copy link
Member

dbaeumer commented Jul 2, 2021

@beginor does the validation happen correctly when you use eslint in the terminal (e.g. using the workspace folder as the current cwd and executing eslint client/projects/web/src/main.ts. If this is the case can you please provide me with a GitHub repository I can clone that demos what you are experiencing.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Jul 2, 2021
@beginor
Copy link
Author

beginor commented Jul 2, 2021

The repository is here https://github.com/beginor/net-core-app , after clone it, just open the root folder with vscode, do not open as workspace, and change to client folder, run npm i.

The root folder of the workspaceis not a nodejs project, there is no node_modules and .eslintrc.json in it, if I run eslint in the root folder, I can get the same error.

The client folder is an angular project, which is a nodejs project, so I run npm run lint in the client folder, which calls will call eslint , the output is correct, the command works.

I have just switch from tslint to eslint, since tslint is obsoleted, but this works with tslint before.

@dbaeumer
Copy link
Member

dbaeumer commented Jul 2, 2021

This then sounds like a configuration problem with ESLint itself (if you see it in the terminal). Try if you can run eslint correctly when you are in the client folder. If this is the case then you need to let VS Code know about this as well using eslint.workingDirectories

@beginor
Copy link
Author

beginor commented Jul 3, 2021

Thanks you very much, eslint works as expected when I set eslint.workingDirectories=["cients"] in my projects.

@dbaeumer
Copy link
Member

dbaeumer commented Jul 6, 2021

Closing the issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants