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
Allow blacklisting/exclusion of auto import paths.
Here are some possible solutions as I see it:
Allow blacklisting/excluding paths for auto imports
Suggest all possible paths and let the developer choose which path is correct
π Motivating Example
In certain scenarios, such as when using a monorepo with Angular and Nx, you will have an index.ts file for your libraries which acts as the entry point. This creates huge issues when using project-relative imports in VSC, as it suggests the index.ts file instead of the actual file when working with imports that are inside the same library. Using the index.ts file will cause any app consuming the library to crash due to what I assume are circular dependencies.
Here I expect to get ../../helpers/global/is-external-url instead of ../../../index:
π» Use Cases
What do you want to use this for?
See above explanation.
What shortcomings exist with current approaches?
It's really easy to mess up without knowing what is wrong, and there isn't a way to solve this currently as far as I'm aware.
What workarounds are you using in the meantime?
Added an ESLint rule that shows an error when using an index.ts import, still doesn't prevent compilation so you might not even notice that you have an error until you try to build (assuming you have ESLint check enabled when building)
Using "Quick Fix" and then choosing the correct import path there, but this is annoying and wastes your time. The correct path should show up when typing.
The text was updated successfully, but these errors were encountered:
Suggestion
π Search Terms
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Allow blacklisting/exclusion of auto import paths.
Here are some possible solutions as I see it:
π Motivating Example
In certain scenarios, such as when using a monorepo with Angular and Nx, you will have an
index.ts
file for your libraries which acts as the entry point. This creates huge issues when usingproject-relative
imports in VSC, as it suggests theindex.ts
file instead of the actual file when working with imports that are inside the same library. Using theindex.ts
file will cause any app consuming the library to crash due to what I assume are circular dependencies.Here I expect to get
../../helpers/global/is-external-url
instead of../../../index
:π» Use Cases
What do you want to use this for?
See above explanation.
What shortcomings exist with current approaches?
It's really easy to mess up without knowing what is wrong, and there isn't a way to solve this currently as far as I'm aware.
What workarounds are you using in the meantime?
index.ts
import, still doesn't prevent compilation so you might not even notice that you have an error until you try to build (assuming you have ESLint check enabled when building)The text was updated successfully, but these errors were encountered: