[PR #1075] [MERGED] refactor(check): dedupe status sort and App Router file filters #1072

Closed
opened 2026-05-06 13:11:50 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/1075
Author: @james-elicx
Created: 5/5/2026
Status: Merged
Merged: 5/5/2026
Merged by: @james-elicx

Base: mainHead: refactor/cleanup-check-ts-internals


📝 Commits (1)

  • fc7522e refactor(check): dedupe status sort and App Router file filters

📊 Changes

1 file changed (+39 additions, -31 deletions)

View changed files

📝 packages/vinext/src/check.ts (+39 -31)

📄 Description

Summary

Pure-refactor follow-up to #1058. Two related cleanups in packages/vinext/src/check.ts:

A. Status-ordering comparator

The literal { unsupported: 0, partial: 1, supported: 2 } map was inlined inside three separate Array.sort callbacks (in scanImports, analyzeConfig, checkLibraries). Extracted as a single file-private STATUS_ORDER constant plus a compareByStatus() comparator. Each call site now reads as items.sort(compareByStatus).

B. App Router file convention filters

Five parallel endsWith(...) || endsWith(...) filter chains for page, layout, loading, error, and not-found files were collapsed into a single APP_ROUTER_EXTENSIONS table and a small isAppRouterFile(file, type) predicate. The original asymmetry is preserved: page and layout accept .tsx | .jsx | .ts | .js, while the React-component-only boundaries (loading, error, not-found) accept only .tsx | .jsx. The route filter is intentionally left alone because its extension set (.tsx | .ts | .js — no .jsx) is unique to it.

Both helpers stay file-private. No public API change, no behaviour change.

Files changed

  • packages/vinext/src/check.ts (+39 / -31)

Test plan

  • pnpm vp test run tests/check.test.ts (97/97 pass)
  • pnpm fmt --write
  • pnpm knip (clean)

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/1075 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 5/5/2026 **Status:** ✅ Merged **Merged:** 5/5/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `refactor/cleanup-check-ts-internals` --- ### 📝 Commits (1) - [`fc7522e`](https://github.com/cloudflare/vinext/commit/fc7522e689767bfae9c2c14b5504bf0bcce87480) refactor(check): dedupe status sort and App Router file filters ### 📊 Changes **1 file changed** (+39 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/check.ts` (+39 -31) </details> ### 📄 Description ## Summary Pure-refactor follow-up to #1058. Two related cleanups in `packages/vinext/src/check.ts`: ### A. Status-ordering comparator The literal `{ unsupported: 0, partial: 1, supported: 2 }` map was inlined inside three separate `Array.sort` callbacks (in `scanImports`, `analyzeConfig`, `checkLibraries`). Extracted as a single file-private `STATUS_ORDER` constant plus a `compareByStatus()` comparator. Each call site now reads as `items.sort(compareByStatus)`. ### B. App Router file convention filters Five parallel `endsWith(...) || endsWith(...)` filter chains for `page`, `layout`, `loading`, `error`, and `not-found` files were collapsed into a single `APP_ROUTER_EXTENSIONS` table and a small `isAppRouterFile(file, type)` predicate. The original asymmetry is preserved: `page` and `layout` accept `.tsx | .jsx | .ts | .js`, while the React-component-only boundaries (`loading`, `error`, `not-found`) accept only `.tsx | .jsx`. The `route` filter is intentionally left alone because its extension set (`.tsx | .ts | .js` — no `.jsx`) is unique to it. Both helpers stay file-private. No public API change, no behaviour change. ## Files changed - `packages/vinext/src/check.ts` (+39 / -31) ## Test plan - [x] `pnpm vp test run tests/check.test.ts` (97/97 pass) - [x] `pnpm fmt --write` - [x] `pnpm knip` (clean) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:50 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#1072
No description provided.