Open andyrooger opened 4 years ago
I've been experimenting - seems to be the problem is that on Visual Studio the cwd is set to C:\WINDOWS\system32 when this gets run.
CascadingConfigArrayFactory and Linter both have options object that can be passed with a cwd to use. If I set that to something sensible and temporarily process.chdir(...)
for the duration of getESLintResult then I can get this working.
CLIEngine
also has a cwd you can pass but it seems to make things worse...
I think this should be testable outside of VS by just doing a process.chdir
to something silly when the plugin is starting.
For now I'm working around this with a plugin that looks like
function init(modules) {
process.chdir('<project root>');
function create(info) {
return info.languageService;
}
return { create };
}
module.exports = init;
If I load it right before typescript-eslint-language-service
then I can get the plugin loaded and working successfully. It's obviously not a great permanent solution though.
I seeing something similar on macos. I don't use visual studio code, but I wanted to make sure repo/set up worked for people that do. It's 3 years later, so probably a different issue. How did no one else run into this? Are we doing something weird in our eslintrc?
Info 26 [09:16:07.651] Failed to load module 'typescript-eslint-language-service' from /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/node_modules: Error: Could not resolve JS module 'typescript-eslint-language-service' starting at '/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/node_modules'
....
/Applications/node_modules/
...
/node_modules/typescript-eslint-language-service/index.jsx
Why is it trying to load stuff from /Applications/Visual Studio ? and from /node_modules?
https://github.com/typescript-eslint/typescript-eslint/issues/6883
If it is the same problem you can try https://www.npmjs.com/package/vs-compat-ts-plugin - it's how I've been solving the initial problem for a few years.
Contains the code above with a few extra pieces. Though I don't recognise your errors.
Thanks for responding. Sadly, now it's trying to load vs-compat-ts-plugin from the same wrong places. Was worth a try.
Oops. I'm testing in Visual Studio CODE, wrong issue.
If any plugins are specified in the .eslintrc.js then typescript-eslint-language-service fails to load.
In the TSS logs I see the following output: