runem / lit-analyzer

Monorepository for tools that analyze lit-html templates
MIT License
318 stars 36 forks source link

Implement fix for symlinked modules. #130

Closed FelixSchuSi closed 4 years ago

FelixSchuSi commented 4 years ago

When using the analyzer in a project I had problems when using symlinked dependencies. In the project I installed a component library as a symlinked dependecy using lerna.

The no-missing-import rule didn't work as expected in this situation.

  1. The analyzer created a missing-import warning for every custom Element I used from this library (even though the required import statements were present).
  2. When the required import statements were NOT present, the analyzer didn't supply the codefix to add them.

This behaviour occurs because the analyzer cannot follow symlinked dependencies that are out of the scope of the project. With this PR symlinked dependencies can be followed. When a symlinked module is discovered in dependency traversal, the analyzer now uses the actual path of the symlinked module rather than the path that the symlink resolves to.

Any feedback is welcome.

FelixSchuSi commented 4 years ago

I just found out that this PR breaks the CLI. Any possible solutions can be discussed in issue #135.