Encountering an ESLint error when cloning my repository and running npm install on WSL2. The IDE shows this error for all .ts files:
ESLint: Parsing error: Unable to read file
\\wsl$\ubuntu-20.04\home\project_directory\tsconfig.json
The root of this issue lies in the parserOptions
section within my .eslintrc.json
file.
My attempts to resolve this problem include:
- Consulting a thread on StackOverflow:
Parsing error: Cannot read file '.../tsconfig.json'.eslint,
where I converted my JSON configuration to a JavaScript file using
__dirname
. However, this approach did not solve the issue. - Manually selecting the
eslint
from my project'snode_modules
in the IDE settings. Yet, the error persists. - Notably, the project works flawlessly without any ESLint errors when cloned and accessed on a Windows environment instead of WSL. The inconsistency between WSL and Windows is puzzling.
I am seeking assistance as I'm unsure about the next steps to take.
.eslintrc.json
{
"env": {
"browser": true,
"es2021": true,
"node": true,
"jest": true
},
... (remaining content remains the same)
}
tsconfig.json
{
... (remaining content remains the same)
}
package.json
{
... (remaining content remains the same)
}
Config Screenshots:
Automatic:
https://i.sstatic.net/qRk8x.png
Manual:
https://i.sstatic.net/e0CVf.png