question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with @typescript-eslint on project inside sym-linked folder

See original GitHub issue

Due 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:closed
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
dbaeumercommented, Nov 18, 2022

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.

0reactions
dbaeumercommented, Nov 17, 2022

In the case above /users is a symlink to /home

Read more comments on GitHub >

github_iconTop Results From Across the Web

Symlinks cause parserOptions.project errors #2987 - GitHub
If there is a symlink somewhere pointing at a directory, then linting it will throw Parsing error: "parserOptions.project" has been set for @ ......
Read more >
"parserOptions.project" has been set for ... - Stack Overflow
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: /Users/Dan/site ...
Read more >
yarn link
Symlink a package folder during development. For development, a package can be linked into another project. This is often useful to test out...
Read more >
The magic behind npm link - Medium
1. Create (or download) an npm module to your computer: cd ~/Desktop · 2. Run npm link inside the module's root folder: cd...
Read more >
Shareable Configs - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found