projects
/
squeep-html-template-helper
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bump package version to 1.6.1
[squeep-html-template-helper]
/
test
/
lint-html.js
diff --git
a/test/lint-html.js
b/test/lint-html.js
index 50abb84784ff732d266577718906fa6227dc17ce..57f8241200a8d7beee76e491a3e02cb54129d54d 100644
(file)
--- a/
test/lint-html.js
+++ b/
test/lint-html.js
@@
-6,13
+6,27
@@
const assert = require('node:assert');
const assert = require('node:assert');
+/**
+ * @typedef {object} ConsoleLike
+ * @property {Function} debug debug
+ */
+
+/**
+ * @typedef {import('html-validate')} HtmlValidateModule
+ */
+
/**
* Given an instance of html-validate, returns a function which asserts validity of some HTML.
/**
* Given an instance of html-validate, returns a function which asserts validity of some HTML.
- * @param {ConsoleLike} logger
- * @param {HtmlValidate
} htmlValidat
e
- * @returns {(html:
String) => Promise<void>}
+ * @param {ConsoleLike} logger
logger
+ * @param {HtmlValidate
Module.HtmlValidate} htmlValidate html-validate instanc
e
+ * @returns {(html:
string) => Promise<void>} function which lints html
*/
function makeHtmlLint(logger, htmlValidate) {
*/
function makeHtmlLint(logger, htmlValidate) {
+ /**
+ *
+ * @param {any[]} violations array of violations to add to
+ * @param {any} message violation to add
+ */
function note(violations, message) {
violations.push(message.ruleId);
logger.debug('HtmlLint', message);
function note(violations, message) {
violations.push(message.ruleId);
logger.debug('HtmlLint', message);
@@
-22,7
+36,7
@@
function makeHtmlLint(logger, htmlValidate) {
const report = await htmlValidate.validateString(html);
report.results.forEach((r) => {
if (Array.isArray(r)) {
const report = await htmlValidate.validateString(html);
report.results.forEach((r) => {
if (Array.isArray(r)) {
- r
esult
.forEach((m) => {
+ r.forEach((m) => {
note(violations, m);
});
} else {
note(violations, m);
});
} else {