ts-unused-exports: False positive with path aliases and sub-folders

Steps to reproduce with example\with-paths:

  1. Move utils\src\calculations.ts into a new sub-folder utils\src\sub\calculations.ts.
  2. Update import statement in math.ts to import {calculations} from 'utils/sub/calculations';
  3. Run ts-unused-exports example\with-paths\tsconfig.json
  4. utils\src\sub\calculations.ts: calculations is falsely reported as unused.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 15

Commits related to this issue

Most upvoted comments

UPDATE:

Ineed, the problem is the file being imported is index Another very similar file other works OK.

but at this point its simpler for me to manage, as a separate related issue.

@mrseanryan sorry for the delay, there are no more false positives.

@ilyin371 @kevinoliveira have a fix here:

https://github.com/pzavolinsky/ts-unused-exports/pull/176

If you have the time, it would great to get feedback before we merge and release.

Branch is:

fix/path-aliases-and-sub-folders

cheers @kevinoliveira

I think it is related to the #customAlias part:

import { sayHelloWorldInJapanese } from "#customAlias/helpers";

This helps a lot!

same issue here, I can confirm it’s due to path aliases. i can create a reproducible environment later today.

PS: awesome project