4 * A brief wrapper around html-validate
7 const assert
= require('node:assert');
8 const { HtmlValidate
} = require('html-validate'); // eslint-disable-line node/no-unpublished-require
9 const stubLogger
= require('./stub-logger');
12 constructor(logger
, ...args
) {
14 this.htmlValidate
= new HtmlValidate(...args
);
18 const ruleViolations
= [];
19 const report
= await
this.htmlValidate
.validateString(html
);
20 report
.results
.forEach((m
) => {
21 ruleViolations
.push(m
.ruleId
);
22 stubLogger
?.debug('LintHtml', 'message', m
);
24 assert(report
.valid
, '' + ruleViolations
.join(', '));
28 module
.exports
= LintHtml
;