Lint the frontend with eslint in its own Docker stage (closes #47)
check / check (push) Successful in 1m58s
check / check (push) Successful in 1m58s
script/lint ran prettier --check, the same check script/fmt-check runs, so the JavaScript had no linter. eslint now runs with its recommended rules, set in eslint.config.js, in a new frontend-lint stage of Dockerfile built from the pinned node image and the lockfile. The frontend stage copies a file from it, as the builder stage does from the Go lint stage, so the image cannot build unless eslint passed. script/lint builds both lint stages with --no-cache and runs no linter on the host; script/fmt-check keeps prettier on the host, and script/frontend-check drops its lint step. The viewport harness fixes the two kinds of finding eslint made. bootstrap wants node 22.13.0, as eslint 10 does. Also covers item 2 of #28. Model: opus-5-5
This commit is contained in:
@@ -16,6 +16,10 @@ import { collectLayoutFacts } from "./facts.js";
|
||||
import { evaluateChecks, INTERACTIVE_SELECTORS } from "./checks.js";
|
||||
import { deriveViewports } from "./viewports.js";
|
||||
|
||||
// page.waitForFunction and page.evaluate run the functions given them in
|
||||
// the page, where these are defined.
|
||||
/* global document, requestAnimationFrame */
|
||||
|
||||
function required(name) {
|
||||
const value = process.env[name];
|
||||
if (!value) {
|
||||
@@ -62,7 +66,6 @@ function stableHash(text) {
|
||||
|
||||
async function connectBrowser() {
|
||||
const deadline = Date.now() + BROWSER_TIMEOUT_MS;
|
||||
let lastError;
|
||||
for (;;) {
|
||||
try {
|
||||
const response = await fetch(`${CDP_URL}/json/version`);
|
||||
@@ -77,9 +80,10 @@ async function connectBrowser() {
|
||||
});
|
||||
return { browser, version: info.Browser };
|
||||
} catch (error) {
|
||||
lastError = error;
|
||||
if (Date.now() > deadline) {
|
||||
throw new Error(`browser never came up: ${lastError}`);
|
||||
throw new Error(`browser never came up: ${error}`, {
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
await sleep(250);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user