When I define 2+ custom externals (i.e. not npm packages, but externals that I have created and am loading in at the runtime), it appears this linting rule picks up the first one and ignores all subsequent imports. After investigating, it appears to be related to the caching mechanism.
To Reproduce
In the boundaryTest.ts file I setup I only have two imports shown here:
For the two imports above, I have these added to the import/no-unresolved rule as shown here since they are modules consumed at the runtime:
I have a relatively simple setup when it comes to the boundary rule:
Upon running yarn lint, I only ever see an error message around the first external import I disallowed (in this case web-runtime-commons-constants):
Expected behavior
I would expect it to show an error message for both external imports.
Additional context
After debugging the issue, it seems related to the following PR where the cache was added. Specifically the isExternal prop is never added to the second import because after the cache is hit the first time (using the key src/boundaryTest.ts) it never proceeds to the second import in which it would get added:
I am actually able to fix this using the following approaches:
Simply disable the importsCache.save on line 228.
I can also fix this by downgrading the version of my lib to 2.3.0, which is a state of the lib before the cache was introduced.
Adding a reference to the module in compilerOptions.paths within tsconfig.json. However I don't really want to do this as I'm informing eslint to ignore this by adding these modules to the import/no-unresolved rule in my eslint config.
Describe the bug
When I define 2+ custom externals (i.e. not npm packages, but externals that I have created and am loading in at the
runtime
), it appears this linting rule picks up the first one and ignores all subsequent imports. After investigating, it appears to be related to the caching mechanism.To Reproduce
In the
boundaryTest.ts
file I setup I only have two imports shown here:For the two imports above, I have these added to the
import/no-unresolved
rule as shown here since they are modules consumed at the runtime:I have a relatively simple setup when it comes to the boundary rule:
Upon running
yarn lint
, I only ever see an error message around the first external import I disallowed (in this caseweb-runtime-commons-constants
):Expected behavior
I would expect it to show an error message for both external imports.
Additional context
After debugging the issue, it seems related to the following PR where the cache was added. Specifically the
isExternal
prop is never added to the second import because after the cache is hit the first time (using the keysrc/boundaryTest.ts
) it never proceeds to the second import in which it would get added:I am actually able to fix this using the following approaches:
importsCache.save
on line 228.2.3.0
, which is a state of the lib before the cache was introduced.compilerOptions.paths
within tsconfig.json. However I don't really want to do this as I'm informing eslint to ignore this by adding these modules to theimport/no-unresolved
rule in my eslint config.