chore(ui): move existing inline null/empty and typeof checks to the guards
I maintainer di solito rispondono entro 1 giorno
@bitcoinbrisbane ci sta già lavorando.
Dal 1/11/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Why
UI Architecture Commandment 8 (CLAUDE.md) says null, empty and length checks go through src/utils/guards.ts. Since #933, the Guards CI job (yarn check:guards) enforces this, but only on lines a PR adds. Older code was never moved over, so it doesn't match the rule. Any PR that touches those files either inherits the old checks or ends up mixing unrelated guard fixes into its diff (as #936 did; now closed).
The last adoption pass was #449 (#451, #453, #459, #473).
What's left on main (9420ff5)
Counted with the same rules check:guards uses (scripts/guards/rules.ts), over whole files. Comments and // guards-ok lines are skipped.
136 hand-written null/empty/length checks in 63 files
| Use instead | Count |
|---|---|
hasValue(x) |
64 |
isNullish(x) |
48 |
isEmpty(x) / isBlank(x) |
12 |
hasElements(x) / hasContent(x) |
12 |
Densest files: pages/TableAdminPage.tsx (15), bus/GameMessageBus.ts (8), components/bridge/StuckPaymentsPanel.tsx (8), pages/Dashboard.tsx (6), submit/ActionSubmitController.ts (5), utils/turnClock.ts (5).
30 typeof checks in 19 files, mostly narrowing an unknown reply field, e.g.
const msg = typeof raw?.message === "string" ? raw.message : response.statusText; // hooks/game/useFetchSngClaimSignature.ts
rawLog: typeof rawLog === "string" ? rawLog : "", // submit/txVerdict.ts
if (typeof err === "object" && err !== null) { // apis/HTTPClient.ts
There are no guards for these yet. Most are in constants/currency.ts, submit/txVerdict.ts, components/explorer/ClickableAddress.tsx, audio/actionSoundPlayer.ts and apis/HTTPClient.ts.
Scope
- Replace the 136 checks with the existing guards. Where
nullandundefinedmean different things, keep the strict check and end the line with// guards-ok. Example: #919's ante rule, wherenullmeans "antes off" andundefinedmeans "not set".isNullishwould merge them. - Add type guards for the
typeofcases, with tests inguards.test.ts:isString,isNumber,isBoolean, andisRecordfor "non-null object whose fields can be read". Then switch the 30 sites to them and list the new guards in Commandment 8. - Teach
check:guardsthetypeofpattern so new ones are flagged once the guards exist.
How
- Its own PRs, split by directory (
bus/+submit/,hooks/,components/,pages/,utils/+apis/), not folded into feature PRs. - No behaviour change. Each PR passes
tsc -b, the full jest suite andcheck:guards. - No visible change, so no screenshots.
- Lingua principale
- TypeScript
- Stelle
- 2
- Fork
- 5
- Merge medio
- 22h 3m
- PR unite (30g)
- 103
Preparare l'ambiente
Non abbiamo ancora controllato i file di configurazione di questo progetto. Parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di block52/ui
-
enhancement tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug: next-to-act flash stuck on the last folder when their fold closes a called all-in (fold + runout + hand_ended in one snapshot)Forse già presa @bitcoinbrisbane l’ha presa 2 giorni fa. Apertaanimation bug game-flow sit-and-go UI Week 2
block52/ui#968 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
feat(ui): player language setting and translated player screensForse già presa @Dzeezbtc l’ha presa 3 giorni fa. Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
feat(ui): player notes and tags — click a seat to note a player; tag icons (fish, shark, tight, loose…) show by their pillForse già presa @Dzeezbtc l’ha presa 6 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
architecture refactor tech debt
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
FR: Support CJK brackets, symbols and full-width markers in footnoteHeuristics (EBPAJ support)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
readest/readest#7413 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
content triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
eliasstravik/herdr-projects#788 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Ability to edit tagsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno