r/react • u/Goldziher • 23h ago
OC Skif 0.9 for React monorepos: finding unused components across packages
I maintain Skif, an open-source linter for JavaScript and TypeScript monorepos. One use case is cleaning up a shared React component package after a migration. A component can disappear from every screen but still be re-exported through packages/ui/src/index.ts. Checking local imports in the component file won't tell you whether any app still reaches that export.
Skif builds a module graph across the workspace and reports unused files and exports. The distinction matters for shared UI packages: an unused export can point to a legacy component, while an unused file can point to an entire module that no entry point reaches. I’d review findings before deleting public exports or components loaded by conventions the tool may not see.
In 0.9, the disk cache is on by default, so repeated runs can reuse parse results for unchanged files. Skif reads tool configuration statically. If it can’t read a package’s config, it flags that package as incomplete in the report. If you already use Knip, npx @polylint/skif migrate --dry-run previews the corresponding config.
I’d especially like examples of React entry points that are easy to miss with static analysis. If you use lazy routes, Storybook stories, or a shared library with multiple public entry points, what would you expect the linter to treat as in use?