Skip to content

agneym/knip-v6-tsconfig-paths-repro

Repository files navigation

Knip v6 tsConfig paths proof of concept

This reproduces a Knip v6 path-resolution mismatch when the CLI is pointed at a non-default tsconfig file.

Shape

  • tsconfig.json has no compilerOptions.paths.
  • tsconfig.app.json extends tsconfig.json and defines @app/* -> ./src/*.
  • knip.ts has no paths.
  • src/main.ts imports src/used.ts via @app/used.
  • src/unused.ts is truly unused.

Expected

When running with --tsConfig tsconfig.app.json, Knip should understand @app/used and report only src/unused.ts.

Commands

pnpm install
pnpm knip
pnpm knip:with-paths
pnpm knip:use-tsconfig-files

Observed

  • pnpm knip reports both src/used.ts and src/unused.ts as unused.
  • pnpm knip:with-paths reports only src/unused.ts.
  • pnpm knip:use-tsconfig-files reports nothing and exits 0.

This suggests Knip loads tsconfig.app.json for file context, but the module resolver still does not use its compilerOptions.paths unless aliases are also present in Knip config. --use-tsconfig-files is not equivalent: it avoids the false positive, but also masks the true unused file.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors