From a4dc76c9d20120cbf43a6dd3c672e0529c4a0052 Mon Sep 17 00:00:00 2001 From: Luke Murray Date: Tue, 28 Mar 2023 07:15:26 -0400 Subject: [PATCH 1/2] fix: check if cwd changed to bust mapper cache --- src/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 54d17cc..438dd69 100644 --- a/src/index.ts +++ b/src/index.ts @@ -119,6 +119,8 @@ let previousOptionsHash: string let optionsHash: string let cachedOptions: InternalResolverOptions | undefined +let prevCwd: string + let mappersCachedOptions: InternalResolverOptions let mappers: Array<((specifier: string) => string[]) | null> | undefined @@ -347,9 +349,14 @@ function getMappedPath( } function initMappers(options: InternalResolverOptions) { - if (mappers && mappersCachedOptions === options) { + if ( + mappers && + mappersCachedOptions === options && + prevCwd === process.cwd() + ) { return } + prevCwd = process.cwd() const configPaths = typeof options.project === 'string' From ece2e66df7b626271a03b854d97b146dac03f547 Mon Sep 17 00:00:00 2001 From: JounQin Date: Wed, 29 Mar 2023 22:45:52 +0800 Subject: [PATCH 2/2] Create .changeset/rich-icons-hope.md --- .changeset/rich-icons-hope.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/rich-icons-hope.md diff --git a/.changeset/rich-icons-hope.md b/.changeset/rich-icons-hope.md new file mode 100644 index 0000000..2668349 --- /dev/null +++ b/.changeset/rich-icons-hope.md @@ -0,0 +1,5 @@ +--- +"eslint-import-resolver-typescript": patch +--- + +fix: check if cwd changed to bust mapper cache