{"id":600,"hash":"69ab57ead5286982171164ca5b9848e724b34231cce3838634086c7b4de071b5","pattern":"Parsing error: Cannot read file &#39;.../tsconfig.json&#39;.eslint","full_message":"The error Parsing error: Cannot read file '.../tsconfig.json'.eslint shows in all .ts files in the src folder including index.ts.\n\nI have no idea how to set up configs. The issue just shows a red line and makes the file red. However, everything compiles and run fine. The entire Node project was created using the firebase CLI.\n\ntsconfig.json file:\n\n{\n  \"compilerOptions\": {\n    \"module\": \"commonjs\",\n    \"noImplicitReturns\": true,\n    \"noUnusedLocals\": true,\n    \"outDir\": \"lib\",\n    \"sourceMap\": true,\n    \"strict\": true,\n    \"target\": \"es2017\"\n  },\n  \"compileOnSave\": true,\n  \"include\": [\n    \"src\"\n  ]\n}\n\n.eslintrc.js file:\n\nmodule.exports = {\n  env: {\n    browser: true,\n    es6: true,\n    node: true,\n  },\n  extends: [\n    \"plugin:import/errors\",\n    \"plugin:import/warnings\",\n    \"plugin:import/typescript\",\n  ],\n  parser: \"@typescript-eslint/parser\",\n  parserOptions: {\n    project: \"tsconfig.json\",\n    sourceType: \"module\",\n  },\n  plugins: [\n    \"@typescript-eslint\",\n    \"import\",\n  ],\n  rules: {\n    \"@typescript-eslint/adjacent-overload-signatures\": \"error\",\n    \"@typescript-eslint/no-empty-function\": \"error\",\n    \"@typescript-eslint/no-empty-interface\": \"warn\",\n    \"@typescript-eslint/no-floating-promises\": \"error\",\n    \"@typescript-eslint/no-namespace\": \"error\",\n    \"@typescript-eslint/no-unnecessary-type-assertion\": \"error\",\n    \"@typescript-eslint/prefer-for-of\": \"warn\",\n    \"@typescript-eslint/triple-slash-reference\": \"error\",\n    \"@typescript-eslint/unified-signatures\": \"warn\",\n    \"comma-dangle\": \"warn\",\n    \"constructor-super\": \"error\",\n    eqeqeq: [\"warn\", \"always\"],\n    \"import/no-deprecated\": \"warn\",\n    \"import/no-extraneous-dependencies\": \"error\",\n    \"import/no-unassigned-import\": \"warn\",\n    \"no-cond-assign\": \"error\",\n    \"no-duplicate-case\": \"error\",\n    \"no-duplicate-imports\": \"error\",\n    \"no-empty\": [\n      \"error\",\n      {\n        allowEmptyCatch: true,\n      },\n    ],\n    \"no-invalid-this\": \"error\",\n    \"no-new-wrappers\": \"error\",\n    \"no-param-reassign\": \"error\",\n    \"no-redeclare\": \"error\",\n    \"no-sequences\": \"error\",\n    \"no-shadow\": [\n      \"error\",\n      {\n        hoist: \"all\",\n      },\n    ],\n    \"no-throw-literal\": \"error\",\n    \"no-unsafe-finally\": \"error\",\n    \"no-unused-labels\": \"error\",\n    \"no-var\": \"warn\",\n    \"no-void\": \"error\",\n    \"prefer-const\": \"warn\",\n  },\n  settings: {\n    jsdoc: {\n      tagNamePreference: {\n        returns: \"return\",\n      },\n    },\n  },\n};\n\nI had tried restarting VScode, clearing the cache, and all to no avail. I am guessing I need to change some of the paths but I am not very good at changing the config files so I don't want to accidentally break the entire project.","ecosystem":"npm","package_name":"node.js","package_version":null,"solution":"2025 Update: typescript-eslint v8 has stabilised the projectService option, which is now recommended over project. See the Typed Linting with Project Service announcement for further details.\n\nBy default, the projects (in parserOptions) are resolved relative to the current working directory. If you run eslint in a different working directory to the folder containing tsconfig.json, @typescript-eslint/parser will not be able to locate the file.\n\nTo fix this, you can set tsconfigRootDir to __dirname, which would make the parser resolve the project configuration relative to .eslintrc.js.\n\nLegacy config:\n\nmodule.exports = {\n  // ...\n  parserOptions: {\n    project: \"tsconfig.json\",\n    tsconfigRootDir: __dirname,\n    sourceType: \"module\",\n  },\n  // ...\n}\n\nESLint’s v9 flat config, eslint.config.mjs (although see the update above regarding projectService):\n\nimport tseslint from 'typescript-eslint'\n\nexport default tseslint.config(\n  // ...\n  {\n    languageOptions: {\n      parserOptions: {\n        project: 'tsconfig.json',\n        tsconfigRootDir: import.meta.dirname,\n      },\n    },\n  },\n);\n\nIf you’re having some trouble with\n\n/path/to/.eslintrc.js\n  0:0  error  Parsing error: \"parserOptions.project\" has been set for @typescript-eslint/parser.\nThe file does not match your project config: .eslintrc.js.\nThe file must be included in at least one of the projects provided\n\nsee the official troubleshooting section on this or this question.","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/64933543/parsing-error-cannot-read-file-tsconfig-json-eslint","votes":292,"created_at":"2026-04-19T04:51:24.112415+00:00","updated_at":"2026-04-19T04:51:24.112415+00:00"}