update project standarts and read me files
This commit is contained in:
1 parent
b990b59698
commit
0ca218505d
2 files changed
+36
-21
No files matched your search
@@ -147,6 +147,9 @@ src/
|
||||
│ └── tableSearch.tsx # Standalone search input for tables
|
||||
│
|
||||
├── features/ # Feature-Sliced Design — one folder per domain
|
||||
│ ├── shared/ # APIs and hooks used by 2+ features
|
||||
│ │ ├── api/ # sharedApi.ts — shared endpoints + TypeScript types
|
||||
│ │ └── hooks/ # useShared[Resource].ts — shared React Query hooks
|
||||
│ └── [feature]/
|
||||
│ ├── api/ # Axios calls + TypeScript types/interfaces
|
||||
│ ├── hooks/ # React Query hooks (useQuery + useMutation)
|
||||
@@ -603,19 +606,21 @@ All authenticated routes are nested under `DashboardLayout`. The full list:
|
||||
- [ ] Register all routes in `src/app/router/index.tsx`.
|
||||
- [ ] Add sidebar nav entries in `DashboardLayout.tsx → navGroups`.
|
||||
- [ ] Add all user-facing strings to `en.json`, `ru.json`, `tk.json`.
|
||||
- [ ] If the API endpoint is used by 2+ features, move it to `src/features/shared/api/sharedApi.ts` and create a `useShared[Resource].ts` hook instead of duplicating it.
|
||||
|
||||
### Strict rules
|
||||
|
||||
| Rule | Detail |
|
||||
| ---------------------------------------- | ----------------------------------------------------------------------------------- |
|
||||
| No `any` | Use `unknown` or define proper interfaces/types. |
|
||||
| No hard-coded strings | Every text must go through `t('key')`. |
|
||||
| No duplicate forms | Create/Edit pages must share one `[Feature]Form` component. |
|
||||
| No bare `try/catch` that swallows errors | Always `console.error` or rethrow. |
|
||||
| No `toast.error()` in hooks | Global `MutationCache.onError` handles it. Use `meta: { silent: true }` to opt out. |
|
||||
| Always show loading states | Use `<Spinner />` or `<Skeleton />` while data loads. |
|
||||
| Disable buttons during mutation | `disabled={mutation.isPending}` on submit buttons. |
|
||||
| `PageErrorBoundary` on every route | Already set via `errorElement` in the router. |
|
||||
| Rule | Detail |
|
||||
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| No `any` | Use `unknown` or define proper interfaces/types. |
|
||||
| No hard-coded strings | Every text must go through `t('key')`. |
|
||||
| No duplicate forms | Create/Edit pages must share one `[Feature]Form` component. |
|
||||
| No bare `try/catch` that swallows errors | Always `console.error` or rethrow. |
|
||||
| No `toast.error()` in hooks | Global `MutationCache.onError` handles it. Use `meta: { silent: true }` to opt out. |
|
||||
| Always show loading states | Use `<Spinner />` or `<Skeleton />` while data loads. |
|
||||
| Disable buttons during mutation | `disabled={mutation.isPending}` on submit buttons. |
|
||||
| `PageErrorBoundary` on every route | Already set via `errorElement` in the router. |
|
||||
| No duplicate API calls | If an endpoint is used by 2+ features, it belongs in `src/features/shared/` — never copy-paste API functions across feature folders. |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user