typescript-eslint-language-service icon indicating copy to clipboard operation
typescript-eslint-language-service copied to clipboard

Making it Windows compatible

Open artola opened this issue 3 years ago • 1 comments

We found that this library works well in posix (Mac, Unix or using WSL) but it fails when we run it on Windows win32.

There are a few places that are "sensible" to the path separator (i.e., / or \\).

It would be great to enhance it to work seamlessly. If you agree I will create a PR with such changes, here some details:

The function isParserModuleNameValid is looking for the existence of parserModuleName, it is used only once as:

isParserModuleNameValid(configFileContent.parser, "@typescript-eslint/parser")

the module could be made system sensible using path.join('@typescript-eslint', 'parser').

https://github.com/Quramy/typescript-eslint-language-service/blob/7f967589611ba07a09c2413aff111257f600f528/src/eslint-adapter.ts#L203

https://github.com/Quramy/typescript-eslint-language-service/blob/7f967589611ba07a09c2413aff111257f600f528/src/eslint-adapter.ts#L118

Something similar around these lines:

https://github.com/Quramy/typescript-eslint-language-service/blob/7f967589611ba07a09c2413aff111257f600f528/src/eslint-config-provider.ts#L76

We can fix it using:

      const fragments = require.resolve("eslint").split(path.join("node_modules", "eslint"));
      path.join(...fragments.slice(0, fragments.length - 1), "node_modules", "eslint", "conf", `${name}.js`);

artola avatar Jun 28 '22 07:06 artola

I'm facing the same issue.

Any update? @Quramy

awydler avatar Jul 15 '22 13:07 awydler