Skip to content

Support glob patterns in ignoreDependencies #2953

Description

@azu

Problem

ignoreDependencies matches package names by exact string equality only (as documented in schema.json). A monorepo that needs to ignore a whole scope has to list every package by name, and the list must be updated each time a workspace package is added.

A glob-looking entry is accepted silently and has no effect, so the mistake is easy to miss:

{ "ignoreDependencies": ["@repro/*"] }
$ fallow dead-code
● Unused dependencies (1)
  @repro/lib (packages/app/package.json)

Only the exact name "@repro/lib" works in this case (fallow 3.30.0).

knip accepts regex in ignoreDependencies (we used "@acme/.+" before migrating), and fallow migrate drops such entries with a warning (migrate_knip_regex_ignore_deps_skipped in crates/cli/src/migrate/knip.rs). The migrated config therefore no longer applies these exclusions.

Proposed solution

Accept glob patterns in ignoreDependencies, with the same glob syntax as ignorePatterns and ignoreExports[].file:

{ "ignoreDependencies": ["@acme/*", "@types/*"] }
  • Entries without glob metacharacters keep the current exact-match behavior, so existing exact-name configs are unaffected.
  • fallow migrate could then convert simple knip regexes such as "@org/.+" to "@org/*" instead of dropping them.
  • A warning for a pattern that matches no declared dependency (or reporting it through stale-suppressions) would help catch typos.

Alternatives considered

  • Listing every package by name. We currently maintain 26 @acme/* names in ignoreDependencies.
  • An overrides entry that turns off unused-dependencies for the affected packages. This also hides real unused third-party dependencies in those packages, so it is too broad.

Related bug

Our immediate use case is #2952: workspace dependencies reached only through package.json imports aliases are reported as unused. The glob request would reduce the maintenance cost of the workaround; fixing the alias bug would remove the need for that workaround.

Even after that bug is fixed, a scope-level ignore stays useful for packages that are loaded by name at runtime.

Activity

  1. added a commit that references this issue on Sep 29, 2026
    1e2c213
  2. BartWaardenburg commented on Sep 30, 2026

    @BartWaardenburg
    Collaborator

    ignoreDependencies accepts globs in fallow 3.31.0 (npm install fallow@3.31.0), so "@repro/*" from your example now matches @repro/lib.

    An entry with *, ?, [ or { is a glob in the ignorePatterns syntax. An entry without these characters keeps the exact-name match. fallow migrate now converts a regex such as @acme/.+ to @acme/* when the glob matches the same packages. For typos, a glob that matches no declared dependency shows as ignore-dependencies-glob-unmatched in workspace_diagnostics[], and the human output prints a note on stderr.

    Thanks for the request and the fallow migrate detail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions