UNPKG

@felixgeelhaar/cclint

Version:

Catch CLAUDE.md drift before Claude misbehaves. Lints CLAUDE.md, skills, subagents, and hooks for Claude Code projects.

53 lines 2.01 kB
import type { Rule } from '../domain/Rule.js'; import { ContextFile } from '../domain/ContextFile.js'; import { Violation } from '../domain/Violation.js'; /** * Rule that validates import resolution and detects circular dependencies * * @remarks * Validates that @path/to/file imports: * - Point to files that actually exist * - Don't create circular dependency chains * - Respect the 5-hop maximum depth limit * - Resolve correctly in the directory hierarchy * * @see {@link https://docs.claude.com/en/docs/claude-code/memory#claude-md-imports | CLAUDE.md import documentation} * * @category Rules */ export declare class ImportResolutionRule implements Rule { readonly id = "import-resolution"; readonly description = "Validates that imports resolve to existing files and detects circular dependencies"; private readonly maxDepth; constructor(maxDepth?: number); appliesTo(file: ContextFile): boolean; lint(file: ContextFile): Violation[]; /** * Extract all imports from a file */ private extractImports; /** * Decide whether an `@token` is a Claude Code file import rather than an * @-mention, an email, a decorator, or an npm scope. A real import is a file * path, so it must (a) start at a word boundary — never mid-word, which * excludes `user@example.com` — and (b) look like a path: a relative / * absolute / home prefix, or a file extension. This trades a little recall * (a bare `@docs/guide` with no extension is not treated as an import) for a * large drop in false positives on ordinary prose — which were ERRORs that * failed the build. */ private isLikelyImport; /** * Check if position is inside a code span */ private isInCodeSpan; /** * Resolve import path to absolute file path */ private resolvePath; /** * Validate import depth recursively */ private validateImportDepth; } //# sourceMappingURL=ImportResolutionRule.d.ts.map