Skip to content

Commit

Permalink
try hv 9
Browse files Browse the repository at this point in the history
  • Loading branch information
fulldecent committed Dec 4, 2024
1 parent 1e687f7 commit 192d967
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 32 deletions.
7 changes: 0 additions & 7 deletions .htmlvalidate.json

This file was deleted.

15 changes: 15 additions & 0 deletions .htmlvalidate.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from 'htmlvalidate';

export default defineConfig({
"plugins": ["<rootDir>/test/plugin.html-validate.mjs"],
"extends": ["html-validate:prettier", "<rootDir>/test/plugin.html-validate.mjs:recommended"],
"rules": {
"mailto-awesome": "error",
"external-links": "error",
"no-jquery": "error",
"canonical-link": "error",
"latest-packages": "error",
"https-links": "error",
"internal-links": "error"
}
});
20 changes: 4 additions & 16 deletions test/build-html-validate.mjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
import { HtmlValidate, formatterFactory } from "html-validate";
import { HtmlValidate, FileSystemConfigLoader, formatterFactory, esmResolver } from "html-validate";
import { glob } from "glob";
import plugin from "./plugin.html-validate.mjs";

// Find and sort all HTML files in the 'build' directory
const targets = glob.sync("build/**/*.html").sort();

// Initialize HtmlValidate instance
const htmlValidate = new HtmlValidate({
extends: ["html-validate:prettier"],
plugins: [plugin],
rules: {
"mailto-awesome": "error",
"external-links": "error",
"no-jquery": "error",
"canonical-link": "error",
"latest-packages": "error",
"https-links": "error",
"internal-links": "error",
},
});

const resolver = esmResolver();
const loader = new FileSystemConfigLoader([resolver]);
const htmlValidate = new HtmlValidate(loader);
const formatter = formatterFactory("stylish");
let allTestsPassed = true;

Expand Down
6 changes: 2 additions & 4 deletions test/plugin.html-validate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import LatestPackagesRules from "./plugin.html-validate.latest-packages.mjs";
import EnsureHttpsRules from "./plugin.html-validate.https-links.mjs";
import CheckInternalLinks from "./plugin.html-validate.internal-links.mjs";

const plugin = definePlugin({
export default definePlugin({
name: "pacific-medical-training",
rules: {
"mailto-awesome": MailtoAwesomeRule,
Expand All @@ -32,6 +32,4 @@ const plugin = definePlugin({
},
},
},
});

export default plugin;
});
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,9 @@ __metadata:
languageName: node
linkType: hard

"html-validate@npm:^8.27.0":
version: 8.27.0
resolution: "html-validate@npm:8.27.0"
"html-validate@npm:^9.0.0-rc.3":
version: 9.0.0-rc.3
resolution: "html-validate@npm:9.0.0-rc.3"
dependencies:
"@html-validate/stylish": "npm:^4.1.0"
"@sidvind/better-ajv-errors": "npm:3.0.1"
Expand All @@ -668,7 +668,7 @@ __metadata:
optional: true
bin:
html-validate: bin/html-validate.js
checksum: 10c0/c1e32841a3c45f6c0336d2f4175b29bc0a54c188150bc60a3951c6c71cde724daa3b3ef6ed6f1c690f5ed89c30fb572691b8a5144c6c82b7b42545a04f7bc8cd
checksum: 10c0/a60c71cade632426084b2ff3bc1fbff36114ca07e5675e9a5da6f8946b52e295fb4fa3a9e3c8ac8ad00f1b99fcc2e149bdc4be98684f334c2760431b14e17bac
languageName: node
linkType: hard

Expand Down Expand Up @@ -1444,7 +1444,7 @@ __metadata:
better-sqlite3: "npm:^11.6.0"
front-matter: "npm:^4.0.2"
glob: "npm:^11.0.0"
html-validate: "npm:^8.27.0"
html-validate: "npm:^9.0.0-rc.3"
markdownlint-cli2: "npm:^0.15.0"
prettier: "npm:^3.4.2"
shell-quote: "npm:^1.8.2"
Expand Down

0 comments on commit 192d967

Please sign in to comment.