Prerequisites
Reproduction url
https://github.com/WooWan/knip-workspace-hint-reproduction
Reproduction access
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?
Prerequisites
Reproduction url
https://github.com/WooWan/knip-workspace-hint-reproduction
Reproduction access
Description of the issue
When
--workspaceis set, configuration hints are unconditionally disabled:As a result,
--treat-config-hints-as-errorssilently does nothing in workspace-scoped runs(
cli.tsguards the exit code on!isDisableConfigHints, and reporters/IssueCollectorskip hint collection entirely).
Reproduction
Why this matters
In large monorepos, CI typically runs Knip per changed workspace. In that setup, stale
ignoreDependencies/ignore/ignoreFilesentries can never fail CI — even when theybelong to the selected workspace. This is surprising because
--workspaceis a scopingoption, 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?