mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
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 <[email protected]>
This commit is contained in:
1 parent
ad6bd60f89
commit
83622c53ef
2 files changed
+27
-12
No files matched your search
+2
-1
@@ -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",
|
||||
|
||||
@@ -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
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user