Skip to content

🐛 --workspace disables configuration hints and makes --treat-config-hints-as-errors a silent no-op #1790

Description

@WooWan

Prerequisites

Reproduction url

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

Reproduction access

  • I've made sure the reproduction is publicly accessible

Description of the issue

When --workspace is set, configuration hints are unconditionally disabled:

// packages/knip/src/util/create-options.ts
isDisableConfigHints: args['no-config-hints'] || isProduction || Boolean(workspace),

As a result, --treat-config-hints-as-errors silently does nothing in workspace-scoped runs
(cli.ts guards the exit code on !isDisableConfigHints, and reporters/IssueCollector
skip hint collection entirely).

Reproduction

# services/knip-reproduction has a stale ignoreDependencies(react)
knip --treat-config-hints-as-errors                          # reports hint, exits 1 ✅
knip --workspace services/knip-reproduction --treat-config-hints-as-errors # no hint, exits 0 ❌

Why this matters

In large monorepos, CI typically runs Knip per changed workspace. In that setup, stale
ignoreDependencies / ignore / ignoreFiles entries can never fail CI — even when they
belong to the selected workspace. This is surprising because --workspace is a scoping
option, while config hints are a hygiene signal.

Suggested fix

Would it make sense to keep configuration hints enabled for --workspace runs, but filter
them to the selected workspace?

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