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
In version 3.5.0 of the plugin, the comparison for the cached resolver options was updated to use the object hash instead of referential equality. However, this led to a subtle bug with monorepo setups in VSCode where the import resolver would cache the path map from one project for all projects resulting in continual errors for all other projects.
I went into the rabbit hole and figured out that it was because the initMappers function relies on process.cwd():
It seems a simple solution is to also check if process.cwd() has changed in initMappers. I can put together a quick PR for that if it seems like a reasonable solution.
The text was updated successfully, but these errors were encountered:
@kingston I submitted a PR. linked above. I didn't do a deep dive into the code but if you want to double check that it does what you would expect that would be helpful. It's only two lines. Trying to push this through. If it doesn't match what you would expect. Feel free to comment and I'll fix it up, or you can submit your own and I'll close mine out.
@kingston I submitted a PR. linked above. I didn't do a deep dive into the code but if you want to double check that it does what you would expect that would be helpful. It's only two lines. Trying to push this through. If it doesn't match what you would expect. Feel free to comment and I'll fix it up, or you can submit your own and I'll close mine out.
In version 3.5.0 of the plugin, the comparison for the cached resolver options was updated to use the object hash instead of referential equality. However, this led to a subtle bug with monorepo setups in VSCode where the import resolver would cache the path map from one project for all projects resulting in continual errors for all other projects.
I went into the rabbit hole and figured out that it was because the
initMappers
function relies onprocess.cwd()
:eslint-import-resolver-typescript/src/index.ts
Line 335 in d8dd3ca
However, the logic for checking whether to initMappers only check options:
eslint-import-resolver-typescript/src/index.ts
Line 326 in d8dd3ca
process.cwd()
has changed as well. Therefore, the cache for mappers is never updated resulting in an error when theprocess.cwd()
is changed. This is something that the VSCode ESLint plugin does to support multiple working directories (https://github.com/microsoft/vscode-eslint/blob/560df864580a9381d84b2f1e408f46f6600fda48/server/src/eslint.ts#L1056).It seems a simple solution is to also check if process.cwd() has changed in initMappers. I can put together a quick PR for that if it seems like a reasonable solution.
The text was updated successfully, but these errors were encountered: