You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This error happens when I use symlink as my workspace dir, e.g. /home/xxx/workspace/ -> /workspace
I tried to div into source code and found languageServer use symlink uri when file changed, e.g. /home/xxx/workspace/src/index.js
but typescript-estree use extra.tsconfigRootDir = '/workspace' to createProjectProgram.
I also found a way to solve this problem:
function getFileSystemPath(uri: URI): string {
const result = uri.fsPath;
if (process.platform === 'win32' && result.length >= 2 && result[1] === ':') {
// Node by default uses an upper case drive letter and ESLint uses
// === to compare paths which results in the equal check failing
// if the drive letter is lower case in th URI. Ensure upper case.
return result[0].toUpperCase() + result.substr(1);
} else {
return fs.realpathSync(result); // I added fs.realpathSync to solve this problem
}
}
Let me know if this solution is correct, thank you
The text was updated successfully, but these errors were encountered:
six-ponies
changed the title
[]
[Error] Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser
Apr 20, 2020
Actually I am not a fan of blindly making this change since it will affect quite some other code passes as well. Can you please elaborate what you think is the root cause of this and why the typescript-eslint/parser complain about it with a parsing error. This is absolutely not clear to me.
This error happend at @typescript-eslint/typescript-estree/src/createProjectProgram.ts line 35
extra = {
tsconfigRootDir: '/workspace', // tsconfigRootDir is initialized by process.cwd() which returns realpath not symlink
filePath: '/home/xxx/workspace/src/index.ts' // in this case, filePath is initialized by vscode-eslint/eslintServer.ts
// ignore other properties
}
typescript-estree uses 'extra' opotions to init typescript program, typescript program reads all files defined by our '/workspace/tsconfig.json' based on tsconfigRootDir and stores as a Map which key is the filename start with '/workspace' not '/home/xxx/workspace'.
so currentProgram.getSourceFile(extra.filePath) returns undefined
Hi~ I found an error descibed above, and my versions are listed below:
eslint configs:
This error happens when I use symlink as my workspace dir, e.g.
/home/xxx/workspace/ -> /workspace
I tried to div into source code and found languageServer use symlink uri when file changed, e.g.
/home/xxx/workspace/src/index.js
but typescript-estree use extra.tsconfigRootDir = '/workspace' to createProjectProgram.
I also found a way to solve this problem:
Let me know if this solution is correct, thank you
The text was updated successfully, but these errors were encountered: