Parsing error: Cannot read file ‘..tsconfig.json’.eslint

While working with multiple projects solution in VSCode, if you are getting the following error in each .ts file Parsing error: Cannot read file ‘..tsconfig.json’.eslint, then you need to do the following steps solve the issue:

Go to the .eslintrc.json file of your project and find the “project”: [“tsconfig.json”] line. Initially it will be like this:

{
  "root": true,
  "ignorePatterns": ["projects/**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "project": ["tsconfig.json"],
        "createDefaultProgram": true
      },

You need to change the “project”: [“tsconfig.json”], line to “project”: [“<YourProjectName>/tsconfig.json”],. The file should look like this after your modification:

{
  "root": true,
  "ignorePatterns": ["projects/**/*"],
  "overrides": [
    {
      "files": ["*.ts"],
      "parserOptions": {
        "project": ["<YourProjectName>/tsconfig.json"],
        "createDefaultProgram": true
      },

In teh above code, replace <YourProjectName> with your project name. The goal is to tell ESLint the relative location of your tsconfig.json file.

Reload the VSCode and the issue will be fixed.

Alternatively,

You can go to .vscode > settings.json and add the following line to fix the same issue:

"eslint.workingDirectories": ["./<YourProjectName>"],