Skip to content

Commit d0eaf70

Browse files
authored
Merge pull request #55 from bartstc/chore/typecheck
chore: add typecheck script and CI job, fix Permission imports
2 parents f45b02d + 37e8601 commit d0eaf70

13 files changed

Lines changed: 55 additions & 39 deletions

File tree

.claude/rules/architecture.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ paths:
99
## Project Structure
1010

1111
- `src/features/` — feature modules using feature slice architecture
12-
- `src/lib/api/` — centralized API layer: queryOptions factories, mutations, DTOs by resource
1312
- `src/lib/` — shared utilities, components, HTTP client, i18n, routing, theme
13+
. `src/lib/api/` — centralized API layer: queryOptions factories, mutations, DTOs by resource
14+
- `src/lib/permissions/` — permission gating utilities. Available permissions: `@/features/authv2/models/permissions`
1415
- `src/pages/` — route-level page components composing features
1516
- `src/app/` — app-level config (App.tsx, Providers.tsx)
1617
- `e2e/` — Playwright end-to-end tests

.github/workflows/ci.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ jobs:
2020
test-type: lint
2121
test-command: pnpm lint
2222

23+
typecheck:
24+
uses: ./.github/workflows/run-tests.yml
25+
with:
26+
test-type: typecheck
27+
test-command: pnpm typecheck
28+
2329
playwright-tests:
2430
uses: ./.github/workflows/playwright.yml
2531
with:
@@ -152,7 +158,8 @@ jobs:
152158
path: coverage/**/*
153159

154160
build:
155-
needs: [lint-tests, unit-tests, storybook-tests, playwright-tests]
161+
needs:
162+
[lint-tests, typecheck, unit-tests, storybook-tests, playwright-tests]
156163
runs-on: ubuntu-latest
157164
steps:
158165
- name: Checkout

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TypeScript SPA. React 19, Vite 7, React Router 7, TanStack Query, Zustand, XStat
99
## Commands
1010

1111
- `pnpm dev` — start dev server (port 5173)
12+
- `pnpm typecheck` — type-check all sources (src, e2e, stories, tests)
1213
- `pnpm lint --fix` — lint and auto-fix
1314
- `pnpm test` — all tests (unit + storybook)
1415
- `pnpm test:e2e` — Playwright E2E (headless)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ It's recommended to run the dev server inside a container for consistent Node/PN
7979
| `pnpm dev` | Dev server with HMR on port `5173` |
8080
| `pnpm dev:server` | Local API server only on port `3001` |
8181
| `pnpm dev:all` | Frontend + API server together |
82+
| `pnpm typecheck` | Type-check all sources without emitting |
8283
| `pnpm lint` | Check for lint errors |
8384
| `pnpm build` | Production build |
8485
| `pnpm test` | Run all tests (unit + storybook) |

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"test:e2e:ci": "playwright test --reporter=junit --reporter=html --reporter=json",
2222
"test:coverage": "vitest run --coverage",
2323
"preview": "vite preview",
24+
"typecheck": "tsc --noEmit",
2425
"lint": "eslint . --ignore-pattern '*.d.ts' --report-unused-disable-directives --max-warnings 0",
2526
"prepare": "husky install",
2627
"storybook": "storybook dev -p 6006",

server/src/db/db.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,10 +518,18 @@
518518
{
519519
"id": "00000000-0000-0000-0000-000000000001",
520520
"userId": 1,
521-
"date": "2026-04-11T08:01:51.825Z",
521+
"date": "2026-04-14T14:13:41.156Z",
522522
"products": [
523523
{
524-
"productId": "4f968992-1aab-49c9-8913-09405915c1c6",
524+
"productId": "4f968992-1aab-49c9-8913-09405915c1c8",
525+
"quantity": 1
526+
},
527+
{
528+
"productId": "4f968992-1aab-49c9-8913-09405915c1c9",
529+
"quantity": 1
530+
},
531+
{
532+
"productId": "4f968992-1aab-49c9-8913-09405915c1c1",
525533
"quantity": 1
526534
}
527535
]

src/features/authv2/application/auth-machine.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { describe, it, expect, vi } from "vitest";
22
import { createActor, fromPromise } from "xstate";
33

4-
import { Permission, Role } from "@/features/authv2/models/user-roles";
4+
import { Permission } from "@/features/authv2/models/permissions";
5+
import { Role } from "@/features/authv2/models/user-roles";
56
import { sleep } from "@/lib/sleep";
67
import type { OneOfUnion } from "@/lib/types/one-of-union";
78
import { UserFixture } from "@/test-lib/fixtures/user-fixture";
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export enum Permission {
2+
Read = "read",
3+
Write = "write",
4+
Edit = "edit",
5+
}

src/features/authv2/models/user-roles.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
export enum Permission {
2-
Read = "read",
3-
Write = "write",
4-
Edit = "edit",
5-
}
1+
import type { Permission } from "@/features/authv2/models/permissions";
62

73
export enum Role {
84
Reader = "reader",

src/features/authv2/providers/get-roles.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
import {
2-
Permission,
3-
Role,
4-
type UserRoles,
5-
} from "@/features/authv2/models/user-roles";
1+
import { Permission } from "@/features/authv2/models/permissions";
2+
import { Role, type UserRoles } from "@/features/authv2/models/user-roles";
63
import { sleep } from "@/lib/sleep";
74

85
export async function getRoles(): Promise<UserRoles> {

0 commit comments

Comments
 (0)