@felixgeelhaar/cclint
Version:
Catch CLAUDE.md drift before Claude misbehaves. Lints CLAUDE.md, skills, subagents, and hooks for Claude Code projects.
20 lines • 710 B
JavaScript
import { Violation } from '../../../domain/Violation.js';
import { Severity } from '../../../domain/Severity.js';
/**
* Validates JSON code blocks by attempting to parse their content and reporting
* any syntax error.
*/
export class JsonValidator {
validate(block, context) {
const violations = [];
try {
JSON.parse(block.content);
}
catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Invalid JSON';
violations.push(new Violation(context.ruleId, `Invalid JSON syntax: ${errorMessage}`, Severity.ERROR, block.location));
}
return violations;
}
}
//# sourceMappingURL=JsonValidator.js.map