fix: satisfy eslint in build-used-by and capture scripts

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Yang Jun
2026-06-22 20:14:55 +08:00
co-authored by Cursor
parent 73e122ad1d
commit 2f8a652ccb
2 changed files with 7 additions and 10 deletions
+3 -2
View File
@@ -19,8 +19,9 @@ function escapeHtml (str) {
} }
function websiteFavicon (url) { function websiteFavicon (url) {
return 'https://t0.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=' return 'https://t0.gstatic.com/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&url=' +
+ encodeURIComponent(url) + '&size=128' encodeURIComponent(url) +
'&size=128'
} }
async function githubAvatar (url) { async function githubAvatar (url) {
+4 -8
View File
@@ -1,3 +1,4 @@
/* global liquidjs */
import { spawn, execFile } from 'node:child_process' import { spawn, execFile } from 'node:child_process'
import { access, copyFile, mkdir, rm } from 'node:fs/promises' import { access, copyFile, mkdir, rm } from 'node:fs/promises'
import { dirname, join } from 'node:path' import { dirname, join } from 'node:path'
@@ -40,7 +41,7 @@ async function waitForServer (maxMs = 120000) {
const res = await fetch(url) const res = await fetch(url)
if (res.ok) return if (res.ok) return
} catch {} } catch {}
await new Promise((r) => setTimeout(r, 500)) await new Promise((resolve) => setTimeout(resolve, 500))
} }
throw new Error(`Timed out waiting for ${url}`) throw new Error(`Timed out waiting for ${url}`)
} }
@@ -53,7 +54,7 @@ async function ensureDocsDeps () {
} }
} }
async function prepareCapture (page, { fullTemplate, fullContext, fullHtml }) { async function prepareCapture (page, { fullTemplate, fullContext }) {
await page.addStyleTag({ await page.addStyleTag({
content: ` content: `
#editors .capture-pane { #editors .capture-pane {
@@ -78,7 +79,6 @@ async function prepareCapture (page, { fullTemplate, fullContext, fullHtml }) {
captureWidth, captureWidth,
fullTemplate, fullTemplate,
fullContext, fullContext,
fullHtml,
lineHeight, lineHeight,
windowChrome, windowChrome,
gridGap, gridGap,
@@ -128,11 +128,9 @@ async function prepareCapture (page, { fullTemplate, fullContext, fullHtml }) {
const templateLineCount = fullTemplate.split('\n').length const templateLineCount = fullTemplate.split('\n').length
const contextLineCount = fullContext.split('\n').length const contextLineCount = fullContext.split('\n').length
const outputLineCount = Math.max(fullHtml.split('\n').length, 1)
const templateEditorH = paneHeight(templateLineCount) const templateEditorH = paneHeight(templateLineCount)
const contextEditorH = paneHeight(contextLineCount) const contextEditorH = paneHeight(contextLineCount)
const outputEditorH = paneHeight(outputLineCount)
const leftRow1 = templateEditorH const leftRow1 = templateEditorH
const leftRow2 = contextEditorH const leftRow2 = contextEditorH
@@ -203,7 +201,6 @@ async function prepareCapture (page, { fullTemplate, fullContext, fullHtml }) {
captureWidth: CAPTURE_WIDTH, captureWidth: CAPTURE_WIDTH,
fullTemplate, fullTemplate,
fullContext, fullContext,
fullHtml,
lineHeight: LINE_HEIGHT, lineHeight: LINE_HEIGHT,
windowChrome: WINDOW_CHROME, windowChrome: WINDOW_CHROME,
gridGap: GRID_GAP, gridGap: GRID_GAP,
@@ -297,9 +294,8 @@ async function main () {
const fullTemplate = await page.evaluate(() => window.ace.edit('editorEl').getValue()) const fullTemplate = await page.evaluate(() => window.ace.edit('editorEl').getValue())
const fullContext = await page.evaluate(() => window.ace.edit('dataEl').getValue()) const fullContext = await page.evaluate(() => window.ace.edit('dataEl').getValue())
const fullHtml = await page.evaluate(() => document.querySelector('#previewCode').textContent)
await prepareCapture(page, { fullTemplate, fullContext, fullHtml }) await prepareCapture(page, { fullTemplate, fullContext })
const framePaths = [] const framePaths = []
let frameIndex = 0 let frameIndex = 0