import { defaultRules } from "./default-rules.js";
export class Linter {
    rules;
    offenses;
    /**
     * Creates a new Linter instance.
     * @param rules - Array of rule classes (not instances) to use. If not provided, uses default rules.
     */
    constructor(rules) {
        this.rules = rules !== undefined ? rules : this.getDefaultRules();
        this.offenses = [];
    }
    /**
     * Returns the default set of rule classes used by the linter.
     * @returns Array of rule classes
     */
    getDefaultRules() {
        return defaultRules;
    }
    getRuleCount() {
        return this.rules.length;
    }
    lint(document) {
        this.offenses = [];
        for (const Rule of this.rules) {
            const rule = new Rule();
            const ruleOffenses = rule.check(document);
            this.offenses.push(...ruleOffenses);
        }
        const errors = this.offenses.filter(offense => offense.severity === "error").length;
        const warnings = this.offenses.filter(offense => offense.severity === "warning").length;
        return {
            offenses: this.offenses,
            errors,
            warnings
        };
    }
}
//# sourceMappingURL=linter.js.map