Harden static analysis checks - #317
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
a3c0e36 to
2af5820
Compare
| stats: { | ||
| attack: number | ||
| } | ||
| // TODO: Can this be removed? |
There was a problem hiding this comment.
Hmm, why did I leave this comment.
| align?: 'left' | 'right' | undefined | ||
| artwork?: string | undefined | ||
| status?: 'disabled' | 'in-play' | 'idle' | undefined | ||
| orientation?: 'face-up' | 'face-down' | undefined |
There was a problem hiding this comment.
Having both optional and undefined at the same time doesn't seem ideal
| onCreate={(formData) => { | ||
| send({ | ||
| type: 'CREATE_CHARACTER', | ||
| // @ts-expect-error |
| @@ -23,7 +29,6 @@ | |||
| "@xstate/react": "6.1.0", | |||
There was a problem hiding this comment.
Why get rid of concurrently? Isn't this faster?
|
|
||
| /** Overlays the avatar and applies a flash when healing */ | ||
| function HealingFlash({ onAnimationComplete }: { onAnimationComplete?: () => void }) { | ||
| function HealingFlash({ onAnimationComplete }: { onAnimationComplete?: (() => void) | undefined }) { |
There was a problem hiding this comment.
Again with the optional + undefined - can we not do that? One or the other should be fine. It makes things much more complex.
| isStacked?: boolean | undefined | ||
| onClick?: (() => void) | undefined | ||
| className?: string | undefined |
There was a problem hiding this comment.
Again, the optional and undefined typing is not great.
| const characterClass = formData.get('characterClass') | ||
| const characterName = formData.get('characterName') | ||
| const characterPortrait = formData.get('characterPortrait') | ||
| if ( | ||
| typeof characterClass !== 'string' || | ||
| typeof characterName !== 'string' || | ||
| typeof characterPortrait !== 'string' | ||
| ) |
There was a problem hiding this comment.
Do we have zod available to validate these things? Can we add it?
Should that validation be part of the state machine?
| return Math.floor(Math.random() * maxExclusive) | ||
| } | ||
|
|
||
| pick<T>(xs: readonly T[]): T { |
There was a problem hiding this comment.
This method is defined twice.
And each method could use some JSDoc descriptions.
7b75379 to
ab9d69b
Compare
requireAsset was copy-pasted identically across cards.ts, item.ts, and monsters.ts; moved it into vite.ts alongside the other glob helpers. The css[key] ?? '' workaround for noUncheckedIndexedAccess was also repeated ad hoc across ~10 components; added cx()/cssClass() in helpers/css.ts to centralize the safe lookup. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GzLmUWBV6CUEVjoDuTZkAF
b7caefb to
cc93236
Compare
Summary
Validation