Lint
This commit is contained in:
parent
d83691323f
commit
f5f017b01f
14 changed files with 103 additions and 46 deletions
|
|
@ -29,6 +29,12 @@ const failOnIssues =
|
|||
process.argv.includes('--fail-on-issues') ||
|
||||
process.env.ASTRO_AUDIT_FAIL_ON_ISSUES === '1';
|
||||
|
||||
// Heuristic above-fold / below-fold loading rules flip based on the heights of
|
||||
// items rendered above them, which shift whenever a post's description length
|
||||
// changes. They produce false positives that can't be resolved with a single
|
||||
// `eagerThumbnailCount` per list, so the audit suppresses them.
|
||||
const IGNORED_AUDIT_CODES = new Set(['perf-use-loading-eager', 'perf-use-loading-lazy']);
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
|
@ -307,12 +313,14 @@ async function auditRoute(context, baseUrl, route, viewport) {
|
|||
throw new Error(`${route} at ${viewportLabel(viewport)}: ${audit.error}`);
|
||||
}
|
||||
|
||||
return audit.results.map((result) => ({
|
||||
route,
|
||||
url: page.url(),
|
||||
viewport: viewportLabel(viewport),
|
||||
...result,
|
||||
}));
|
||||
return audit.results
|
||||
.filter((result) => !IGNORED_AUDIT_CODES.has(result.code))
|
||||
.map((result) => ({
|
||||
route,
|
||||
url: page.url(),
|
||||
viewport: viewportLabel(viewport),
|
||||
...result,
|
||||
}));
|
||||
} finally {
|
||||
await page.close().catch(() => {});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue