Error with @typescript-eslint on project inside sym-linked folder
See original GitHub issueDue to company policies, on my machine, my home directory (cd ~
) points to /users/<username>
, and /users
is a symbolic link to /home
. When I open a folder in VS Code located under /users
, every TS file I open has the following ESLint error at the top:
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: ../../../../users/<username>/path-to-project/path-to/file.ts.
The file must be included in at least one of the projects provided.
When I open the same folder but from /home
instead of /users
, the error message disappears and the extension works as expected, which confirms that my project’s TypeScript and linting configurations are correct (i.e. parserOptions.project
points to the project’s tsconfig.json
, and the files on which the error appears are properly included by this tsconfig.json
).
This issue has already been reported in the @typescript-eslint
repo: https://github.com/typescript-eslint/typescript-eslint/issues/2234, but the fact that it works fine when running ESLint from the command line, seems to point to the vscode-eslint
extension as the culprit (which probably explains why the issue was closed without being resolved).
It is not a blocker, obviously, since I’m able to open my projects from /home
instead of /users
, but I think it’s worth investigating given that it took me a few frustrating hours before I was able to identify the root cause. I hope this issue can save other people from experiencing this frustration.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (5 by maintainers)
Top GitHub Comments
OK. I did some additional tests that the problem only occurs when sym-linking in the root (e.g. users - home). Since the same problem shows up in the terminal when validating an absolute file I would say it is a problem of the
@typescript-eslint/parser
when they do path math to locate the file.I also tried relative paths in the extension however that resulted in the same problem with root symlinked folders.
I recommend that you open an issue against
@typescript-eslint/parser
Please ping if there is anything else you think I need to do.
In the case above /users is a symlink to /home