From 0971edf4b450cbc77b6a4d465207fab52b6887ce Mon Sep 17 00:00:00 2001 From: Yoshihiro OKUMURA Date: Wed, 4 Nov 2026 13:52:28 +0900 Subject: [PATCH] style: apply the biome 2.6 lint and format fixes Biome 2.6 adds the useMathMinMax and useDomNodeTextContent rules and starts formatting Markdown. - Use Math.max and Math.min for the clamping ternaries - Align the README tables --- README.md | 24 ++++++++++---------- src/database/item-type/lib/field/Preview.tsx | 2 +- src/database/lib/DatabaseListItem.tsx | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index f2c1fa6..753dbc1 100644 --- a/README.md +++ b/README.md @@ -41,14 +41,14 @@ feed, loaded in the browser as JSONP. ## Scripts -| Command | Description | -| --- | --- | -| `npm run dev` | Start the dev server on http://localhost:5173 | -| `npm run build` | Type-check and build into `dist/` | -| `npm run preview` | Serve the production build on http://localhost:4173 | -| `npm run lint` | Lint with [Biome](https://biomejs.dev/) | -| `npm run format` | Format with Biome | -| `npm run check` | Lint, format and organize imports, applying the safe fixes | +| Command | Description | +| ----------------- | ---------------------------------------------------------- | +| `npm run dev` | Start the dev server on http://localhost:5173 | +| `npm run build` | Type-check and build into `dist/` | +| `npm run preview` | Serve the production build on http://localhost:4173 | +| `npm run lint` | Lint with [Biome](https://biomejs.dev/) | +| `npm run format` | Format with Biome | +| `npm run check` | Lint, format and organize imports, applying the safe fixes | `@types/node` is pinned to the major that matches the Node runtime in use (24); `.ncurc.js` keeps `npm-check-updates` from bumping it past that. @@ -90,10 +90,10 @@ the redirects stop working. `.htaccess` redirects these addresses with a 301: -| From | To | -| --- | --- | -| `/modules/xoonips/download.php?file_id=N` | `/modules/xoonips/file/N` | -| `/database/file/...` | `/modules/xoonips/file/...` | +| From | To | +| ----------------------------------------- | --------------------------- | +| `/modules/xoonips/download.php?file_id=N` | `/modules/xoonips/file/N` | +| `/database/file/...` | `/modules/xoonips/file/...` | XOOPS-style addresses (`/modules/xoonips/detail.php?item_id=N`, `/index.php`) are redirected inside the app. diff --git a/src/database/item-type/lib/field/Preview.tsx b/src/database/item-type/lib/field/Preview.tsx index 8c5e76a..f9b8a11 100644 --- a/src/database/item-type/lib/field/Preview.tsx +++ b/src/database/item-type/lib/field/Preview.tsx @@ -47,7 +47,7 @@ const Preview = (props: Props) => { = 0} - index={imageIndex < 0 ? 0 : imageIndex} + index={Math.max(imageIndex, 0)} close={() => setImageIndex(-1)} slides={slides} /> diff --git a/src/database/lib/DatabaseListItem.tsx b/src/database/lib/DatabaseListItem.tsx index b3554cd..c0330b7 100644 --- a/src/database/lib/DatabaseListItem.tsx +++ b/src/database/lib/DatabaseListItem.tsx @@ -177,8 +177,8 @@ const DatabaseListItem = (props: Props) => { ); }; - let startPage = condition.page - 4 > 1 ? condition.page - 4 : 1; - const endPage = startPage + 9 > maxPage ? maxPage : startPage + 9; + let startPage = Math.max(condition.page - 4, 1); + const endPage = Math.min(startPage + 9, maxPage); if (endPage - startPage < 9) { startPage = endPage - 9 > 0 ? endPage - 9 : 1; }