@felixgeelhaar/cclint
Version:
Catch CLAUDE.md drift before Claude misbehaves. Lints CLAUDE.md, skills, subagents, and hooks for Claude Code projects.
43 lines • 1.45 kB
JavaScript
import { Location } from './Location.js';
import { Severity } from './Severity.js';
export class Violation {
ruleId;
message;
severity;
location;
/**
* An optional, structured auto-fix for this violation.
*
* @remarks
* The rule that detects a problem is best placed to describe how to fix it,
* so it may attach the exact edit here. When present, tooling applies this
* edit directly instead of re-deriving one by pattern-matching the message
* (which is brittle and couples the fixer to human-readable wording).
*/
fix;
constructor(ruleId, message, severity, location, fix) {
if (ruleId.trim() === '') {
throw new Error('Rule ID cannot be empty');
}
if (message.trim() === '') {
throw new Error('Message cannot be empty');
}
this.ruleId = ruleId;
this.message = message;
this.severity = severity;
this.location = location;
if (fix !== undefined) {
this.fix = fix;
}
}
toString() {
return `${this.severity.toString()}: ${this.message} at ${this.location.toString()} [${this.ruleId}]`;
}
equals(other) {
return (this.ruleId === other.ruleId &&
this.message === other.message &&
this.severity === other.severity &&
this.location.equals(other.location));
}
}
//# sourceMappingURL=Violation.js.map