Skip to content

Commit fa570b6

Browse files
DaviRain-Suclaude
andcommitted
Apply Biome safe lint autofixes
Mechanical, behavior-preserving fixes from `biome check --write` (safe only): - noUselessEscapeInRegex: drop redundant escapes inside character classes (`\.`→`.`, `\[`→`[`, `\|`→`|`; `\]` correctly kept) in catalog.ts, the wikisource importer, and product-reader.jsx — identical matching. - useConst (turnkey btc `change`), noUselessContinue (liber-core extract loop — the continue was the last stmt in the iteration; added a comment so the now- empty branch reads as intentional). - Dropped a stale `@ts-ignore` on the product-data import (Biome rewrote it to `@ts-expect-error`, which tsc then flagged as unused — the import type-checks fine, so the directive is gone). `npm test` green (176 + 10 + 73). Remaining ~713 lint errors are JSX a11y + correctness that need human judgment (next: triage + ratchet to blocking). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e2565dc commit fa570b6

6 files changed

Lines changed: 10 additions & 10 deletions

File tree

functions/lib/catalog.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function isEnglishSentenceDot(text: string, i: number): boolean {
177177
if (/\b(?:i\.e|e\.g|A\.D|B\.C|U\.S|U\.K)\.$/i.test(before)) return false;
178178
if (/\b[A-Z](?:\.[A-Z])+\.$/.test(before)) return false;
179179
if (/\b[A-Z]\.$/.test(before) && /^\s*[A-Z]\./.test(after)) return false;
180-
return /^\s*(?:["')\]]+\s*)?(?:$|[A-Z0-9"'\[(])/.test(after);
180+
return /^\s*(?:["')\]]+\s*)?(?:$|[A-Z0-9"'[(])/.test(after);
181181
}
182182

183183
function splitSentences(para: string): string[] {
@@ -203,15 +203,15 @@ function splitSentences(para: string): string[] {
203203
function lineLooksHeading(line: string): boolean {
204204
const text = line.trim();
205205
if (!text || text.length > 80) return false;
206-
if (/[\.\?!:;]$/.test(text)) return false;
206+
if (/[.?!:;]$/.test(text)) return false;
207207
const letters = text.replace(/[^A-Za-z]/g, "");
208208
return letters.length >= 4 && letters === letters.toUpperCase();
209209
}
210210

211211
function shouldReflowBlocks(blocks: string[]): boolean {
212212
if (blocks.length < 8) return false;
213213
const proseLines = blocks.filter((b) => b.length >= 35 && b.length <= 95).length;
214-
const unfinished = blocks.filter((b) => !/[\.\?!;:\]")]$/.test(b)).length;
214+
const unfinished = blocks.filter((b) => !/[.?!;:\]")]$/.test(b)).length;
215215
return proseLines / blocks.length > 0.55 && unfinished / blocks.length > 0.35;
216216
}
217217

@@ -234,8 +234,8 @@ function reflowWrappedBlocks(blocks: string[]): string[] {
234234
const line = block.replace(/\s+/g, " ").trim();
235235
if (!line) continue;
236236
const startsStructure =
237-
/^\d+[\.\)]\s+/.test(line) || /^\[[^\]]/.test(line) || lineLooksHeading(line);
238-
const prevComplete = /[\.\?!\]")]$/.test(prev);
237+
/^\d+[.)]\s+/.test(line) || /^\[[^\]]/.test(line) || lineLooksHeading(line);
238+
const prevComplete = /[.?!\]")]$/.test(prev);
239239
if (acc && (startsStructure || prevComplete)) flush();
240240
if (lineLooksHeading(line)) {
241241
flush();

functions/lib/seed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Shared seed data — the SAME catalogue/content the frontend renders, so the
22
// API serves identical reference data. User-generated content (D1) is merged on
33
// top of these baselines on read. One source of truth for both tiers.
4-
// @ts-ignore — plain-JS data module with named exports (no type declarations)
4+
// plain-JS data module with named exports (no type declarations)
55
import * as seed from "../../src/data/product-data.js";
66

77
const s = seed as Record<string, any>;

functions/routes/turnkey.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ turnkey.post("/btc/prepare", async (c) => {
990990
const inVal = BigInt(utxo.value);
991991
const ownProgram = p2wpkhProgram(from);
992992
const recScript = p2wpkhScript(p2wpkhProgram(to));
993-
let change = inVal - amountSats - fee2;
993+
const change = inVal - amountSats - fee2;
994994
const outputs: TxOutput[] = [{ script: recScript, value: amountSats }];
995995
if (change >= DUST_P2WPKH) outputs.push({ script: p2wpkhScript(ownProgram), value: change });
996996
else {

packages/liber-cli/src/liber-core.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ export async function extractEpubChapters(filePath) {
17451745
isNavigationNoiseTitle(title, bookTitle) &&
17461746
!(isSameBookTitle(title, bookTitle) && !chapters.length)
17471747
) {
1748-
continue;
1748+
// navigation-noise entry (cover/TOC/colophon) — intentionally dropped
17491749
} else if (isSameBookTitle(title, bookTitle) && chapters.length) {
17501750
const previous = chapters[chapters.length - 1];
17511751
previous.text = cleanExtractedChapterText(previous.title, `${previous.text}\n\n${text}`);

scripts/import-wikisource-classics.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7291,7 +7291,7 @@ function cleanWikisourceWikitext(raw) {
72917291
text = text.replace(/\[https?:\/\/[^\]\s]+(?:\s+([^\]]+))?\]/giu, "$1");
72927292
text = text.replace(/^\s*(?:(?:|||||)\s*){1,8}\s*$/gmu, "");
72937293
text = stripTemplates(text);
7294-
text = text.replace(/\{\{\s*[Pp]roper[Nn]oun\s*\|\s*([^{}\]\|]+)(?:\}\]|\}|\])/gu, "$1");
7294+
text = text.replace(/\{\{\s*[Pp]roper[Nn]oun\s*\|\s*([^{}\]|]+)(?:\}\]|\}|\])/gu, "$1");
72957295
text = text.replace(/\{\{\s*\*\s*\|[^}\n]*\}/gu, "");
72967296
text = text.replace(/-\{([^{}]+)\}-/gu, (_, body) => chooseVariant(body));
72977297
text = stripTemplates(text);

src/components/product-reader.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,7 +1249,7 @@ function Reader({ bookId, startChapter, onClose, continueConvo, onOpenBook }) {
12491249
);
12501250
};
12511251
const needsSentenceGap = (left, right) =>
1252-
/[A-Za-z0-9"')\]]$/.test(left?.t || "") && /^[A-Za-z0-9"'(\[]/.test(right?.t || "");
1252+
/[A-Za-z0-9"')\]]$/.test(left?.t || "") && /^[A-Za-z0-9"'([]/.test(right?.t || "");
12531253
const renderParagraph = (p, i) => (
12541254
<p key={i}>
12551255
{p.map((s, j) => (

0 commit comments

Comments
 (0)