Skip to content

Add no-hallucinated-imports rule#35

Open
arnavsurve wants to merge 1 commit intomainfrom
rule/no-hallucinated-imports
Open

Add no-hallucinated-imports rule#35
arnavsurve wants to merge 1 commit intomainfrom
rule/no-hallucinated-imports

Conversation

@arnavsurve
Copy link
Contributor

Summary

  • Adds no-hallucinated-imports rule that verifies imported packages exist in package.json
  • Checks static imports, dynamic import(), handles scoped packages, subpath imports, and Node.js builtins
  • Severity: error

Test plan

  • Detects imports of packages not in package.json
  • Allows packages in dependencies, devDependencies, peerDependencies
  • Allows relative imports, node: protocol, Node.js builtins
  • Handles scoped packages and subpath imports
  • Detects dynamic import() of missing packages
  • Config modes test updated with new rule count

🤖 Generated with Claude Code

Checks that imported packages exist in the project's package.json.
Catches a common AI agent mistake of importing packages that don't exist.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@arnavsurve arnavsurve force-pushed the rule/no-hallucinated-imports branch from 74f36b9 to 917cb96 Compare February 14, 2026 02:29
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