Skip to content

feat: show override hygiene hint when overrides detected but --check-overrides not passed#760

Merged
sonukapoor merged 6 commits into
mainfrom
feat/issue-759-override-hint
Jun 25, 2026
Merged

feat: show override hygiene hint when overrides detected but --check-overrides not passed#760
sonukapoor merged 6 commits into
mainfrom
feat/issue-759-override-hint

Conversation

@sonukapoor

Copy link
Copy Markdown
Collaborator

When a project has override entries in package.json but --check-overrides was not passed, the scan output now prints a single discovery tip at the end:

Tip: override entries detected - run with --check-overrides to audit them for stale or broken overrides.

Suppressed in --json, --sarif, --cdx, and --ratchet modes, and when --check-overrides was already passed. No exit code impact, no network calls, no new CLI flags.

What changed

  • src/utils/package-json.ts - new hasOverrideEntries(dir) utility: returns true if any of overrides, pnpm.overrides, or resolutions is a non-empty object
  • src/output/printers.ts - new printOverrideHint() function
  • src/index.ts - wired into both verbose and compact output paths
  • src/scan/multi-folder-scan.ts - wired into multi-folder output (prints once even if multiple subfolders have overrides)
  • Tests for both new functions

Closes #759

…kage.json

Returns true if package.json at a given directory contains at least one
entry in overrides (npm/Bun), pnpm.overrides, or resolutions (Yarn).
Returns false if the file is missing, unreadable, or all containers are empty.
Import hasOverrideEntries and printOverrideHint into src/index.ts and
call printOverrideHint after printFinalStatus (verbose) and after the
renderOverrideFindings block (compact) when override entries are
detected but --check-overrides and --ratchet are not active.

Update jest.unstable_mockModule factories in cli-integration and
multi-folder-printer tests to include printOverrideHint so ESM module
linking does not fail on the new named import.
When running in multi-folder mode, print the override hygiene hint
once if any subfolder has override entries and --check-overrides /
--ratchet are not active. Mocks for hasOverrideEntries and
printOverrideHint added to the multi-folder-scan test.
@sonukapoor sonukapoor merged commit 737b011 into main Jun 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: show override hygiene hint when overrides are detected but --check-overrides was not passed

1 participant