feat(repo): add yaml validation pre-commit hook

This commit is contained in:
2026-02-11 18:31:19 +01:00
parent affd6b3e80
commit 8e99c5abb2
4 changed files with 9848 additions and 4950 deletions

26
scripts/lint-yaml.js Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env node
import fs from "node:fs";
import yaml from "js-yaml";
const files = process.argv.slice(2);
let hasError = false;
if (files.length === 0) {
process.exit(0);
}
for (const file of files) {
try {
const content = fs.readFileSync(file, "utf8");
yaml.load(content);
console.log(`${file} is valid`);
} catch (e) {
console.error(`${file} is invalid: ${e.message}`);
hasError = true;
}
}
if (hasError) {
process.exit(1);
}