AI-native design editor. Open-source Figma alternative.
chore(lint): enforce type safety in scripts
Danila Poyarkovc2afb8ddca7a
diff --git a/oxlint.json b/oxlint.jsonindex d9fe8bf9c..ea8466bff 100644--- a/oxlint.json+++ b/oxlint.json@@ -206,10 +206,7 @@{"files": ["scripts/**/*.ts"],"rules": {- "no-console": "off",- "typescript/no-non-null-assertion": "off",- "open-pencil/no-hand-rolled-color": "off",- "radix": "off"+ "no-console": "off"}}],diff --git a/scripts/visual-compare.ts b/scripts/visual-compare.tsindex 742ed10d6..29663948a 100644--- a/scripts/visual-compare.ts+++ b/scripts/visual-compare.ts@@ -36,7 +36,7 @@ const { values: opts } = parseArgs({})const scale = Number(opts.scale)-const outputDir = opts.output!+const outputDir = opts.output ?? '/tmp/visual-compare'const figmaPath = `${outputDir}/figma.png`const oursPath = `${outputDir}/ours.png`const diffPath = `${outputDir}/diff.png`@@ -122,7 +122,8 @@ async function renderOurs(html: string) {}const ck = await initCanvasKit()- const surface = ck.MakeSurface(1, 1)!+ const surface = ck.MakeSurface(1, 1)+ if (!surface) throw new Error('Failed to create CanvasKit surface')const renderer = new SkiaRenderer(ck, surface)renderer.viewportWidth = 1renderer.viewportHeight = 1@@ -182,11 +183,11 @@ async function diff() {}const result =- await $`magick compare -metric AE -highlight-color red -lowlight-color 'rgba(255,255,255,0.2)' -compose src ${figmaPath} ${oursPath} ${diffPath}`+ await $`magick compare -metric AE -highlight-color red -lowlight-color '#FFFFFF33' -compose src ${figmaPath} ${oursPath} ${diffPath}`.quiet().nothrow()- const diffPixels = parseInt(result.stderr.toString().trim()) || 0+ const diffPixels = parseInt(result.stderr.toString().trim(), 10) || 0const [w, h] = figmaSize.split('x').map(Number)const total = w * hconst pct = ((diffPixels / total) * 100).toFixed(2)