From 83622c53ef1b2fe9773d5b68d54e49da9fe28c94 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 29 Jan 2026 16:05:37 +0000 Subject: [PATCH] chore: Enhance daily design system audit script and config - Add `audit` script to `package.json` to run `scripts/daily-design-system-audit.mjs`. - Update `lint:css` to include `css/docs.css` for better coverage. - Improve `scripts/daily-design-system-audit.mjs` parsing logic for Hex and CSS violations to better handle output formats. - Generate `REMEDIATION_REPORT.md` with current audit results (No violations). Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- package.json | 3 ++- scripts/daily-design-system-audit.mjs | 36 +++++++++++++++++++-------- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 2eba609f..95992b48 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,9 @@ "build:beacon": "npm run build:beacon:bundle && npm run lint:inline-styles", "ci:beacon": "npm run build:beacon", "format": "prettier --cache --write css/tailwind.source.css css/tokens.css \"docs/**/*.html\" tailwind.config.cjs README.md", + "audit": "node scripts/daily-design-system-audit.mjs", "lint": "npm run lint:css && npm run lint:hex && npm run lint:inline-styles && npm run lint:tokens && npm run lint:tailwind-brackets && npm run lint:tailwind-colors", - "lint:css": "stylelint css/tailwind.source.css css/tokens.css", + "lint:css": "stylelint css/tailwind.source.css css/tokens.css css/docs.css", "lint:hex": "node scripts/check-hex.js", "lint:inline-styles": "node scripts/check-inline-styles.mjs", "lint:tokens": "node scripts/check-design-tokens.mjs --check=tokens", diff --git a/scripts/daily-design-system-audit.mjs b/scripts/daily-design-system-audit.mjs index 602d7860..202e0ebf 100644 --- a/scripts/daily-design-system-audit.mjs +++ b/scripts/daily-design-system-audit.mjs @@ -38,8 +38,9 @@ function parseOutput(category, output) { const violations = []; if (category === "Hex Colors") { - // ./js/ui/ambientBackground.js:34: return "#000000"; - const regex = /^(\.\/.*):(\d+):(.*)$/; + // js/ui/ambientBackground.js:34: return "#000000"; + // Also supports ./ prefix if present + const regex = /^(.+?):(\d+):(.*)$/; for (const line of lines) { const match = line.trim().match(regex); if (match) { @@ -101,15 +102,28 @@ function parseOutput(category, output) { // stylelint output // css/tailwind.source.css // 5757:3 ✖ Expected ... - // Just capture raw lines for now if we can't parse easily - // But since stylelint passed in my tests, I might not need complex parsing yet. - // If it fails, I'll just dump the output. - if (output.includes("✖") || output.includes("error")) { - violations.push({ - file: "stylelint output", - line: 0, - snippet: output.trim() // Simplification - }); + let currentFile = ""; + for (const line of lines) { + const trimmed = line.trim(); + // If line looks like a file path (ends with .css) and isn't an error line + if (trimmed.endsWith(".css") && !trimmed.includes("✖")) { + currentFile = trimmed; + } else { + const match = trimmed.match(/^(\d+):(\d+)\s+✖\s+(.+)$/); + if (match && currentFile) { + violations.push({ + file: currentFile, + line: match[1], + snippet: match[3] + }); + } else if (trimmed.includes("✖")) { + violations.push({ + file: currentFile || "unknown", + line: 0, + snippet: trimmed + }); + } + } } }