Skip to content

Commit cb111ea

Browse files
aster-voidclaude
andcommitted
fix: scripts/check-parity の lint・format エラー
- noAssignInExpressions: bucket 代入を分解 - biome auto-format Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 7fc9163 commit cb111ea

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

scripts/check-parity.ts

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ async function checkSoft404() {
206206
// === 3. SEO メタタグ ===
207207
async function checkMeta() {
208208
const r = await fetchFollow("/");
209-
const ogLocale = /(?:property|name)=["']og:locale["'][^>]*content=["']ja_JP["']/i.test(r.body) ||
209+
const ogLocale =
210+
/(?:property|name)=["']og:locale["'][^>]*content=["']ja_JP["']/i.test(r.body) ||
210211
/content=["']ja_JP["'][^>]*(?:property|name)=["']og:locale["']/i.test(r.body);
211-
const twitterSite = /name=["']twitter:site["'][^>]*content=["']@[^"']+["']/i.test(r.body) ||
212+
const twitterSite =
213+
/name=["']twitter:site["'][^>]*content=["']@[^"']+["']/i.test(r.body) ||
212214
/content=["']@[^"']+["'][^>]*name=["']twitter:site["']/i.test(r.body);
213215
record("META", "og:locale=ja_JP", ogLocale, ogLocale ? "found" : "missing on /");
214216
record("META", "twitter:site", twitterSite, twitterSite ? "found" : "missing on /");
@@ -229,7 +231,8 @@ async function checkNoImage() {
229231
record("NO_IMAGE", path, false, `article not reachable (status=${r.status})`);
230232
continue;
231233
}
232-
const broken = r.body.includes("+/images/no-image.svg") ||
234+
const broken =
235+
r.body.includes("+/images/no-image.svg") ||
233236
r.body.includes("%2B/images/no-image.svg") ||
234237
r.body.includes("+%2Fimages%2Fno-image.svg");
235238
record("NO_IMAGE", path, !broken, broken ? "found broken `+/images/no-image.svg`" : "ok");
@@ -239,7 +242,8 @@ async function checkNoImage() {
239242
// === 5. 認可ガード ===
240243
async function checkAuth() {
241244
const admin = await fetchManual("/admin");
242-
const adminOk = (admin.status === 302 || admin.status === 303 || admin.status === 307) &&
245+
const adminOk =
246+
(admin.status === 302 || admin.status === 303 || admin.status === 307) &&
243247
/\/login/.test(admin.location ?? "");
244248
record(
245249
"AUTH",
@@ -281,7 +285,9 @@ async function checkSitemapSamples() {
281285
const buckets: Record<string, string[]> = {};
282286
for (const p of allPaths) {
283287
const key = p.split("/").slice(0, 3).join("/") || "/";
284-
(buckets[key] ??= []).push(p);
288+
const bucket = buckets[key] ?? [];
289+
bucket.push(p);
290+
buckets[key] = bucket;
285291
}
286292
const sampled: string[] = [];
287293
for (const paths of Object.values(buckets)) {
@@ -299,7 +305,9 @@ async function checkSitemapSamples() {
299305
continue;
300306
}
301307
if (r.status === 301 || r.status === 308) {
302-
const followUrl = r.location?.startsWith("http") ? r.location : `${NEW_BASE}${r.location ?? ""}`;
308+
const followUrl = r.location?.startsWith("http")
309+
? r.location
310+
: `${NEW_BASE}${r.location ?? ""}`;
303311
try {
304312
const followed = await fetch(followUrl, { redirect: "follow" });
305313
if (followed.ok) {
@@ -319,9 +327,16 @@ async function checkSitemapSamples() {
319327
}
320328

321329
const detail = `${pass}/${sampled.length} reachable${
322-
failed.length > 0 ? `\n - ${failed.slice(0, 20).join("\n - ")}${failed.length > 20 ? `\n - ... (${failed.length - 20} more)` : ""}` : ""
330+
failed.length > 0
331+
? `\n - ${failed.slice(0, 20).join("\n - ")}${failed.length > 20 ? `\n - ... (${failed.length - 20} more)` : ""}`
332+
: ""
323333
}`;
324-
record("SITEMAP_SAMPLE", `${sampled.length} URLs across ${Object.keys(buckets).length} buckets`, fail === 0, detail);
334+
record(
335+
"SITEMAP_SAMPLE",
336+
`${sampled.length} URLs across ${Object.keys(buckets).length} buckets`,
337+
fail === 0,
338+
detail,
339+
);
325340
}
326341

327342
async function main() {

0 commit comments

Comments
 (0)