Skip to content

Commit e837da2

Browse files
committed
Add import pattern guidelines for namespace imports
1 parent 05c4a91 commit e837da2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ This is a TypeScript implementation of the Package URL (purl) specification for
247247
- **Type imports**: 🚨 ALWAYS use separate `import type` statements for TypeScript types, NEVER mix runtime imports with type imports in the same statement
248248
- ✅ CORRECT: `import { readPackageJson } from '@socketsecurity/registry/lib/packages'` followed by `import type { PackageJson } from '@socketsecurity/registry/lib/packages'`
249249
- ❌ FORBIDDEN: `import { readPackageJson, type PackageJson } from '@socketsecurity/registry/lib/packages'`
250+
- **Import patterns**: 🚨 MANDATORY - Avoid `import * as` pattern except when creating re-export wrappers
251+
- ✅ CORRECT: `import semver from './external/semver'` (default import)
252+
- ✅ CORRECT: `import { satisfies, gt, lt } from './external/semver'` (named imports)
253+
- ❌ AVOID: `import * as semver from './external/semver'` (namespace import - only use in external re-export files)
254+
- **Exception**: External wrapper files in `src/external/` may use `import * as` to create default exports
250255

251256
### Naming Conventions
252257
- **Constants**: Use `UPPER_SNAKE_CASE` for constants (e.g., `CMD_NAME`, `REPORT_LEVEL`)

0 commit comments

Comments
 (0)