webpro-nl/knip

๐Ÿ› In pnpm workspaces storybook stories marked as unused

foxylion opened this issue ยท 3 comments

Prerequisites

Reproduction url

https://stackblitz.com/edit/github-7p1hfp

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

Since version 5.29.2 knip is marking all stories in my project as being unused.

This is reproducible by going to my reproduction example and running the following commands:

pnpm install
pnpm run knip --version # => 5.33.1
pnpm run knip           # reports unused story (see below)

# For reference
pnpx knip@5.29.1 # works fine
pnpx knip@5.29.2 # reports unused story

The reported error is the following:

โžœ pnpm run knip
Packages: +50
++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 50, reused 50, downloaded 0, added 50, done
Unused files (1)
packages/client/src/index.stories.tsx
Unused devDependencies (1)
@storybook/react  package.json

Expected would be

โžœ pnpm run knip
โœ‚๏ธ  Excellent, Knip found no issues.

This is such a double-edged sword. The reason this was changed is to prevent expensive **/ patterns from descending into workspaces and potentially assign dependencies to the wrong workspace. But I understand it should be possible as well. At least the .gitignore has been improved as well to prevent from descending into node_modules and other ignored dirs.

Gave it same thought and reverted the fix, as I don't really see another way out.

๐Ÿš€ This issue has been resolved in v5.33.2. See Release 5.33.2 for release notes.

Using Knip in a commercial project? Please consider becoming a sponsor.

Hi @webpro, thanks for fixing. I can confirm it works now again. :-)