46 lines
2.0 KiB
Markdown
46 lines
2.0 KiB
Markdown
Do not add libraries without asking first or giving me the option to choose a different library
|
|
|
|
## Commands
|
|
|
|
- `deno task dev`: dev server (Vite)
|
|
- `deno task check`: `deno fmt --check`, `deno lint`, and `deno check`. Run this after making changes.
|
|
- `deno task build`: production build into `_fresh/`
|
|
|
|
### Formatting
|
|
|
|
`deno fmt` with **tabs**, indent width 4, line width 120, LF line endings (set in `deno.json`). Use double quotes,
|
|
semicolons and trailing commas.
|
|
|
|
### Naming
|
|
|
|
- **snake_case** for variables, functions, parameters, props and object/DB fields: `parse_date_dmy`, `selected_section`,
|
|
`user_id`, `hint_text`.
|
|
- **PascalCase** for components, interfaces, types and zod schemas
|
|
- **UPPER_SNAKE** for env/config constants: `FILE_UPLOAD_PATH`, `DEV_MODE`.
|
|
- Props interfaces are named `<Component>Props` and declared right above the component.
|
|
|
|
### Language
|
|
|
|
- Everything is in english, always
|
|
|
|
### Imports
|
|
|
|
- Use the `@/` alias for project files: `import { db } from "@/src/db.ts";`. Imports between files inside `src/` may be
|
|
relative (`./db.ts`).
|
|
- Always include the `.ts`/`.tsx` extension.
|
|
- Put third-party imports first, then a blank line, then local imports.
|
|
|
|
### Comments
|
|
|
|
Keep comments sparse. Write a short one only when the code doesn't explain itself (e.g. `// Throws if invalid token`).
|
|
|
|
### Frontend
|
|
|
|
- Use Preact **signals** (`useSignal`, `useComputed`, `Signal` props) for state, not `useState`/`useEffect`.
|
|
- Components are `export default function Name(props: NameProps)`.
|
|
- Put code in an island only when it needs client interactivity. Everything else goes in `components/`.
|
|
- Style with Tailwind classes inline. Use theme colors (`primary-600`, `gray-700`, `error-600`, ...) and the existing
|
|
primitives (`Button` with `variant`/`size`, `InputField`, `SelectField`, `TextAreaField`, `Link`, `Table`) rather than
|
|
raw elements. Merge class overrides with `twMerge`.
|
|
- Avoid React-specific libraries. Vite aliases react to preact, but prefer native Preact solutions.
|