Skip to content

🐛 Workspace discovery ignores later include patterns after negated workspace patterns #1797

Description

@WooWan

Prerequisites

Reproduction url

https://github.com/WooWan/knip-workspace-reproduction

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

Knip fails to discover a workspace that is explicitly included after a negated workspace pattern.

Reproduction repo:

https://github.com/WooWan/knip-workspace-reproduction

pnpm install
pnpm knip:reproduction

The repro uses:

packages:
  - "!packages/*"
  - "packages/should-include"

and:

"knip:reproduction": "knip --workspace packages/should-include"

Expected: Knip should discover and analyze packages/should-include.

Actual: Knip does not treat packages/should-include as an available workspace, so it cannot be selected with --workspace.

It looks like Knip separates negated workspace patterns and applies them as global ignore patterns. Because of that, later positive patterns cannot include workspaces again.

Expected behavior: Knip should preserve workspace pattern ordering/re-inclusion semantics where supported by the package manager, or clearly report that this pattern shape is unsupported.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions