Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not support path aliases #4

Open
mikekreeki opened this issue Sep 14, 2018 · 5 comments
Open

Does not support path aliases #4

mikekreeki opened this issue Sep 14, 2018 · 5 comments

Comments

@mikekreeki
Copy link

Awesome plugin, exactly what we were looking for, but the plugin does not seem to resolve import paths which use aliases defined in tsconfig.

In our project we import like:

 import SomeStore from 'stores/SomeStore'

With tsconfig containing the following:

{
  "compilerOptions": {
    "paths": {
      "stores/*": ["src/js/stores/*"]
    }
  }
}
@electroma
Copy link
Owner

electroma commented Sep 16, 2018

Thank you for your feedback, @mikekreeki! Responsible and consistent usage of path aliases makes code cleaner.

From what I can see at palantir/tslint#3654 and palantir/tslint#3364 (comment) it's not enough to have TypeScript AST. It looks like TSLint doesn't run actual module resolution, which is required to distinguish path-aliased local imports from library imports.

I'll dig into TSLint core and try to figure out if architecturally possible to do some kind of lightweight module resolution (w/o full compilation).

@mikekreeki
Copy link
Author

mikekreeki commented Sep 17, 2018

Thank you so much. I see big value in this plugin for projects with multiple teams working in the same codebase, we feel the pains in managing that manually and being able to do bundle splitting efficiently.

@galkin
Copy link

galkin commented Mar 27, 2019

@electroma, thank you for cool package.

Do you have any updates about this issue?

@uluzox
Copy link

uluzox commented Apr 24, 2019

I wrote a rule myself. It is not as sophisticated but for my use cases it works.
You may want to check it out here

@rickihastings
Copy link

Paths appear to work for me without any issues. I'm using the following versions:

Typescript 3.1.6
Tslint 5.11.0
Tslint-forbidden-imports 1.0.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants