This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch chore/build-maintenance in repository https://gitbox.apache.org/repos/asf/camel-website.git
commit b5e4fdf5f86372ad67ea26a2dc85d4717ee5332a Author: Claus Ibsen <[email protected]> AuthorDate: Sun Nov 29 13:43:28 2026 +0100 chore: upgrade html-validate from 8.29 to 11.21 - The preset is now html-validate:recommended; the htmlvalidate: prefix no longer resolves. - html-validate 9 removed the plugin setup(source) hook, so the camel/structured-data rule read an undefined source and silently checked nothing. Read the JSON-LD from the DOM instead. - aria-label-misuse now reports aria-labelledby on a plain <div>. Every hit in a 255-page sample of the docs is the static tab panel markup of @asciidoctor/tabs (its script adds role=tabpanel at runtime), so the rule skips <div> and keeps checking everything else. - Ignore components/*/others/diagram.html until apache/camel quotes the alt texts of the image macros in camel-diagram's diagram.adoc: the commas in them become width and height values, which attribute-allowed-values now reports. Refs #1882 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y4dDj46SB6GniXf8mX2U6 --- .htmlvalidate.json | 10 +++++++++- .htmlvalidateignore | 5 +++++ package.json | 2 +- rules.js | 30 ++++++++-------------------- yarn.lock | 57 +++++++++++++++++++++++++---------------------------- 5 files changed, 50 insertions(+), 54 deletions(-) diff --git a/.htmlvalidate.json b/.htmlvalidate.json index 5710ad27..56f5c41b 100644 --- a/.htmlvalidate.json +++ b/.htmlvalidate.json @@ -1,11 +1,19 @@ { "extends": [ - "htmlvalidate:recommended" + "html-validate:recommended" ], "plugins": [ "./rules.js" ], "rules": { + "aria-label-misuse": [ + "error", + { + "elements": { + "exclude": ["div"] + } + } + ], "attr-quotes": "off", "camel/relative-links": "error", "camel/structured-data": "error", diff --git a/.htmlvalidateignore b/.htmlvalidateignore index 6e17016b..034bb668 100644 --- a/.htmlvalidateignore +++ b/.htmlvalidateignore @@ -1,3 +1,8 @@ public/google*.html public/camel-k/latest/apis/camel.html public/camel-k/latest/apis/crds-html.html +# The image macros in camel-diagram's diagram.adoc have unquoted alt texts with +# commas, so Asciidoctor turns the text after the commas into width and height +# (html-validate 9+ reports it as attribute-allowed-values). Remove this line +# once apache/camel quotes them, e.g. image::ROOT:x.png["A route diagram: a, b"]. +public/components/*/others/diagram.html diff --git a/package.json b/package.json index 6d60c88d..2e4d13b4 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "gulp-cheerio": "~1.0", "gulp-htmlmin": "~5.0", "gulp-inject": "^5.0.2", - "html-validate": "^8.9.1", + "html-validate": "~11.21.1", "hugo-extended": "^0.169.0", "js-yaml": "^4.3.1", "jsdom": "^27.1.0", diff --git a/rules.js b/rules.js index 2bf21ec8..0d44d53e 100644 --- a/rules.js +++ b/rules.js @@ -56,37 +56,23 @@ class StructuredData extends Rule { }; } + // Reads the script body from the DOM. html-validate 9 removed the plugin + // `setup(source)` hook this used to slice the raw source with, after which + // the rule silently checked nothing. setup() { - let start = -1; - - this.on('tag:open', event => { - if (event.target.nodeName === 'script') { - start = event.target.location.offset; - } - }); - - this.on('tag:close', async event => { - const tag = event.previous; - if (event.target.nodeName === 'script' && tag.hasAttribute('type') && tag.getAttribute('type').value === 'application/ld+json') { - const startIdx = data.indexOf('>', start) + 1; - const endIdx = event.target.location.offset - 1; // omit the opening tag angled bracket - const content = data.substring(startIdx, endIdx); + this.on("dom:ready", event => { + event.document.querySelectorAll('script[type="application/ld+json"]').forEach(script => { try { - JSON.parse(content); + JSON.parse(script.textContent); } catch (err) { - this.report(tag, `Unable to parse JSON-LD as JSON: ${err}`); + this.report(script, `Unable to parse JSON-LD as JSON: ${err}`); } - } + }); }); } } -let data; - module.exports = { - setup(source) { - data = source.data; - }, rules: { "camel/title": HtmlTitle, "camel/relative-links": RelativeLinks, diff --git a/yarn.lock b/yarn.lock index 686451f3..f4e8eaac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1190,12 +1190,10 @@ __metadata: languageName: node linkType: hard -"@html-validate/stylish@npm:^4.1.0": - version: 4.3.0 - resolution: "@html-validate/stylish@npm:4.3.0" - dependencies: - kleur: "npm:^4.0.0" - checksum: 10/23906eb8e575fa2c0cc77c594a855d95a7c291ca4fde764a8ae47fa6506c8023cc8acaba61e3d755580f46badf475286bb0ac212ca373a6c23bc570033bdf5a8 +"@html-validate/stylish@npm:^6.0.0": + version: 6.1.0 + resolution: "@html-validate/stylish@npm:6.1.0" + checksum: 10/cb0b608a7c99e277e77ef74d4943434373b600c8728c7ba84248df3cec98eeff5073258ef6e1162bf1dec74ca2c7e717b730184cf352e9f052998a93a390f6ec languageName: node linkType: hard @@ -2906,14 +2904,12 @@ __metadata: languageName: node linkType: hard -"@sidvind/better-ajv-errors@npm:3.0.1": - version: 3.0.1 - resolution: "@sidvind/better-ajv-errors@npm:3.0.1" - dependencies: - kleur: "npm:^4.1.0" +"@sidvind/better-ajv-errors@npm:7.0.0": + version: 7.0.0 + resolution: "@sidvind/better-ajv-errors@npm:7.0.0" peerDependencies: - ajv: ^6.12.3 || ^7.0.0 || ^8.0.0 - checksum: 10/a51722563a87cec4ae8c28927099e8b45f0a61d0f7c38c2a092fa5a5ff2375924390711b78184207b0ce7ad3fc811f3e0edc402b1960adca48c9389e507b9239 + ajv: ^8.0.0 + checksum: 10/9cfaa3bf7c1cb9a4b7b8c3d0c6a8144edd9533408839b386eaf83c03da0964fa4868020caa3048091ab17dde20fc0602d38a4d8a84f8c71f1c7c287132ebff93 languageName: node linkType: hard @@ -4029,7 +4025,7 @@ __metadata: gulp-cheerio: "npm:~1.0" gulp-htmlmin: "npm:~5.0" gulp-inject: "npm:^5.0.2" - html-validate: "npm:^8.9.1" + html-validate: "npm:~11.21.1" hugo-extended: "npm:^0.169.0" js-yaml: "npm:^4.3.1" jsdom: "npm:^27.1.0" @@ -11044,35 +11040,36 @@ __metadata: languageName: node linkType: hard -"html-validate@npm:^8.9.1": - version: 8.29.0 - resolution: "html-validate@npm:8.29.0" +"html-validate@npm:~11.21.1": + version: 11.21.1 + resolution: "html-validate@npm:11.21.1" dependencies: - "@html-validate/stylish": "npm:^4.1.0" - "@sidvind/better-ajv-errors": "npm:3.0.1" + "@html-validate/stylish": "npm:^6.0.0" + "@sidvind/better-ajv-errors": "npm:7.0.0" ajv: "npm:^8.0.0" - glob: "npm:^10.0.0" kleur: "npm:^4.1.0" - minimist: "npm:^1.2.0" prompts: "npm:^2.0.0" semver: "npm:^7.0.0" peerDependencies: - jest: ^27.1 || ^28.1.3 || ^29.0.3 - jest-diff: ^27.1 || ^28.1.3 || ^29.0.3 - jest-snapshot: ^27.1 || ^28.1.3 || ^29.0.3 - vitest: ^0.34.0 || ^1.0.0 || ^2.0.0 + "@jest/globals": ^29.0.3 || ^30.0.0 + "@vitest/expect": ^3.2.0 || ^4.0.1 || ^5.0.0 + jest: ^29.0.3 || ^30.0.0 + jest-snapshot: ^29.0.3 || ^30.0.0 + vitest: ^3.2.0 || ^4.0.1 || ^5.0.0 peerDependenciesMeta: - jest: + "@jest/globals": + optional: true + "@vitest/expect": optional: true - jest-diff: + jest: optional: true jest-snapshot: optional: true vitest: optional: true bin: - html-validate: bin/html-validate.js - checksum: 10/4b730067ed9ccd8c1a38a452495f13bdc16bd2bbecbc8166546f66ed8e25ca7e82e7a8245d73caad886fc3b11b3ccecd347b463c4280556c45a979eb07b6462d + html-validate: bin/html-validate.mjs + checksum: 10/1711419f42fb9f8ba19126b7a87dc4aff84929cf85456c275132f81f8314bee04e6b818f17d7b5268bf3fd15f5e27c88dd83461ccff58d474b65ebffe9d045b1 languageName: node linkType: hard @@ -12852,7 +12849,7 @@ __metadata: languageName: node linkType: hard -"kleur@npm:^4.0.0, kleur@npm:^4.1.0": +"kleur@npm:^4.1.0": version: 4.1.5 resolution: "kleur@npm:4.1.5" checksum: 10/44d84cc4eedd4311099402ef6d4acd9b2d16e08e499d6ef3bb92389bd4692d7ef09e35248c26e27f98acac532122acb12a1bfee645994ae3af4f0a37996da7df
