Parsing error: Cannot read file tsconfig.json, when it's in subfolders and not in root
See original GitHub issueHi, I have nested subprojects, with individual esling
and tsconfig
configurations, which get parsed correctly from command line, but not from the extension.
You can check the repo in its current state at: https://github.com/fcole90/fullstack_open_2020_part9/tree/f56f5c6c2df77b80c2f7e4df42c07fe6718ff53a
Details
I have a root folder fullstack_open_2020_part9
, which contains some subfolders, each with a separate .eslintrc
and an associate tsconfig.json
. If I run eslint --ext .ts .
within each of the subfolders I get the correct parsing. However, the extension doesn’t read the right configuration file: e.g. in the file fullstack_open_2020_part9/patientor/backend/index.ts
it reports Parsing error: Cannot read file '/home/fabio/Projects/aalto/fullstack_open_2020_part9/tsconfig.json'
but I would be expecting it to check /home/fabio/Projects/aalto/fullstack_open_2020_part9/patientor/backend/tsconfig.json
instead.
Note
I used this same dir structure for other projects (most of those “fullstack_open_2020_part*” you can find among my repos) which didn’t use Typescript, and .js
files were parsed correctly without any need to customise ESlint options.
I think this issue might be related to using this extension with an eslint
file pointing to a parserOptions.project
with a relative link like mine:
"parserOptions": {
"project": "./tsconfig.json"
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Solved by adding
.vscode/settings.json
at the root of the project with the following content (as you suggested):Link to repo with fix: https://github.com/fcole90/fullstack_open_2020_part9
@dbaeumer,
I was able to fix or workaround the issue by using:
… to force ESLint (or probably TS-ESlint) to use the file in the current directory. It’s a bit strange that it doesn’t do this by default though.
Perhaps PhpStorm changes into the configuration directory before running ESLint.