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

Not found tsconfig.json if open project on parent directory #1232

Closed
netdjw opened this issue Apr 6, 2021 · 2 comments
Closed

Not found tsconfig.json if open project on parent directory #1232

netdjw opened this issue Apr 6, 2021 · 2 comments
Labels
info-needed Issue requires more information from poster

Comments

@netdjw
Copy link

netdjw commented Apr 6, 2021

Hello,

I run into this issue when I try to change from tslint to ESLint in VSCode with an Angular project.

The project directory structure is this:

|- .git/
|- angular/
|  |- src/
|  `- .eslintrc.json
|- laravel/
`- other-files.txt

If I open VSCode like this, I get some errors on every .ts files with this message:

Parsing error: Cannot read file '/home/djw/code/myproject/tsconfig.json'. eslint

So I need to change the .eslintrc.json file like this:

      "parserOptions": {
        "project": [
          "tsconfig.json",
          "e2e/tsconfig.json"
        ],
        "tsconfigRootDir": "angular/",  // THIS LINE IS ADDED
        "createDefaultProgram": true
      },

Now the VSCode ESLint plugin works fine.

But if I try to run ng lint command, I get an error:

0:0 error Parsing error: Cannot read file 'angular/tsconfig.json'

Any idea how can I fix this issue?

@dbaeumer
Copy link
Member

dbaeumer commented Apr 6, 2021

@netdjw I am not very familiar with ng lint. What you can try for VS Code is to set the eslint.workingDirectoies setting to angular to ensure the working directory is setting correctly.

@dbaeumer dbaeumer added the info-needed Issue requires more information from poster label Apr 6, 2021
@netdjw
Copy link
Author

netdjw commented Apr 6, 2021

@dbaeumer thanks, I added this code in my project folder to this file: .vscode/settings.json

{
    "eslint.workingDirectories": [
        "angular"
    ]
}

Now the error is gone.

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