Skip to content

fix: resolve TypeScript pnpm imports#63

Merged
alxxjohn merged 5 commits into
mainfrom
fix/ai-quality-false-positives
Jul 25, 2026
Merged

fix: resolve TypeScript pnpm imports#63
alxxjohn merged 5 commits into
mainfrom
fix/ai-quality-false-positives

Conversation

@alxxjohn

@alxxjohn alxxjohn commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes quality.ai.hallucinated-import false positives in TypeScript/JavaScript pnpm monorepos by resolving imports with the context available to the importing file rather than only the target-root manifest.

Resolver changes

  • Reads the nearest ancestor package.json for each source file, including dependencies, devDependencies, and peerDependencies.
  • Recognizes named workspace packages discovered from workspace manifests, including scoped packages.
  • Checks standard node_modules locations while walking from the importer toward the scan root.
  • Checks pnpm's .pnpm virtual store for installed packages.
  • Uses package entries in pnpm-lock.yaml as a conservative installed-package fallback when node_modules is unavailable.
  • Parses JSONC tsconfig*.json files and resolves configured baseUrl/paths aliases when the mapped target exists.
  • Supports NodeNext/Bundler-style runtime .js, .mjs, and .cjs specifiers resolving to TypeScript source files (for example, ./config.js to config.ts).

Regression coverage

Adds a pnpm-monorepo fixture covering:

  • react
  • next/navigation
  • @prisma/client
  • workspace imports
  • pnpm virtual-store packages
  • lockfile-only package resolution
  • tsconfig path aliases
  • .js extension imports targeting .ts files

Validation

  • go test ./internal/codeguard/checks/quality passes.
  • git diff --check passes.

@alxxjohn
alxxjohn force-pushed the fix/ai-quality-false-positives branch from 89a2268 to fcec2dc Compare July 24, 2026 22:21
@alxxjohn
alxxjohn force-pushed the fix/ai-quality-false-positives branch from dc61f7e to fcec2dc Compare July 24, 2026 22:25
@alxxjohn
alxxjohn merged commit 4d3cc59 into main Jul 25, 2026
16 checks passed
@alxxjohn
alxxjohn deleted the fix/ai-quality-false-positives branch July 25, 2026 00:26
alxxjohn added a commit that referenced this pull request Jul 25, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.2.2](v1.2.1...v1.2.2)
(2026-07-25)


### Bug Fixes

* parse pnpm lockfile package entries
([11acbd6](11acbd6))
* reduce AI quality false positives
([fd5d103](fd5d103))
* reduce AI quality false positives
([dc61f7e](dc61f7e))
* reduce AI quality false positives
([#64](#64))
([b80b5c3](b80b5c3))
* resolve TypeScript pnpm imports
([154adc3](154adc3))
* resolve TypeScript pnpm imports
([#63](#63))
([4d3cc59](4d3cc59))
* satisfy import resolver lint
([fcec2dc](fcec2dc))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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.

1 participant