refactor: dead-code cleanup + drop the lib/types shim (slice 9)

- Delete orphaned components (theme-provider, task-claim-button), the unused
  roleDisplayName helper, the fully-dead cleanupRateLimits, the 6 never-imported
  validation schemas (signIn/signUp/createSpace/joinSpace — a replaced auth flow;
  proposalStatuses; updateAreaLeadRoleSchema).
- Migrate all @/lib/types importers to the canonical @/types/domain and delete
  the compatibility shim.

tsc 0, 635 tests green, lint clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Moheeb Zara
2026-08-04 06:19:11 -07:00
co-authored by Claude Opus 4.8
parent 71ba558522
commit f775f954ad
20 changed files with 11 additions and 147 deletions
-5
View File
@@ -47,8 +47,3 @@ export async function getRoleLabelMap(
return map
}
export function roleDisplayName(map: Record<string, RoleLabel> | null | undefined, role: string): string {
if (map && map[role]) return map[role].name
const d = DEFAULT_ROLE_LABELS[role as BuiltinRole]
return d ? d.name : role
}
-12
View File
@@ -139,18 +139,6 @@ export function checkRateLimit(
return { allowed: true, remaining: maxRequests - entry.count, resetIn: entry.resetTime - now }
}
/**
* Clear expired rate limit entries (call periodically)
*/
export function cleanupRateLimits(): void {
const now = Date.now()
for (const [key, entry] of rateLimitStore.entries()) {
if (now > entry.resetTime) {
rateLimitStore.delete(key)
}
}
}
/**
* Validate content length
*/
-7
View File
@@ -1,7 +0,0 @@
/**
* Compatibility shim. The hand-written domain types moved to `types/domain/*`
* (kept separate from the generated `types/database.ts`). This re-export keeps
* the `@/lib/types` specifier working for existing importers; prefer importing
* from `@/types/domain` in new code.
*/
export * from '@/types/domain'
-30
View File
@@ -1,30 +0,0 @@
import { z } from 'zod'
import { emailField } from './primitives'
export const signInSchema = z.object({
email: emailField(),
password: z.string().min(1, 'Password is required'),
})
export const signUpSchema = z.object({
email: emailField(),
password: z.string().min(8, 'Password must be at least 8 characters'),
fullName: z.string().min(1, 'Full name is required').max(100, 'Name is too long'),
action: z.enum(['create', 'join']),
spaceName: z.string().max(100).optional(),
spaceSlug: z.string().regex(/^[a-z0-9]+$/, 'Slug must be lowercase letters and numbers only').max(50).optional(),
city: z.string().max(100).optional(),
inviteCode: z.string().max(20).optional(),
})
export const createSpaceSchema = z.object({
spaceName: z.string().min(1, 'Space name is required').max(100, 'Name is too long'),
spaceSlug: z.string().min(1, 'Slug is required').max(50).regex(/^[a-z0-9]+$/, 'Slug must be lowercase letters and numbers only'),
spaceCity: z.string().max(100).optional(),
displayName: z.string().min(1, 'Display name is required').max(100),
})
export const joinSpaceSchema = z.object({
inviteCode: z.string().min(1, 'Invite code is required').max(20),
displayName: z.string().min(1, 'Display name is required').max(100),
})
-1
View File
@@ -4,7 +4,6 @@ import { flexibleDateTime } from './primitives'
// ─── Governance: proposals ───────────────────────────────────────────────────
export const proposalTypes = ['bylaw_change','board_action','membership_vote','advisory_poll','recall','budget'] as const
export const proposalStatuses = ['draft','open','decided','withdrawn','expired'] as const
export const thresholdRules = ['simple_majority','two_thirds','three_fourths','unanimous'] as const
export const votePositions = ['yes','no','abstain','recused'] as const
-1
View File
@@ -1,5 +1,4 @@
export * from './primitives'
export * from './auth'
export * from './tasks'
export * from './projects'
export * from './members'
-5
View File
@@ -24,11 +24,6 @@ export const createAreaLeadRoleSchema = z.object({
color: z.string().max(20).optional().nullable(),
})
export const updateAreaLeadRoleSchema = z.object({
name: z.string().min(1).max(100).optional(),
color: z.string().max(20).optional().nullable(),
})
export const assignAreaLeadSchema = z.object({
area_lead_role_id: z.string().uuid('Invalid role ID'),
member_id: z.string().uuid('Invalid member ID'),