2.0 KiB
2.0 KiB
Do not style anything for now
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, anddeno 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>Propsand 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 insidesrc/may be relative (./db.ts). - Always include the
.ts/.tsxextension. - 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,Signalprops) for state, notuseState/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 (Buttonwithvariant/size,InputField,SelectField,TextAreaField,Link,Table) rather than raw elements. Merge class overrides withtwMerge. - Avoid React-specific libraries. Vite aliases react to preact, but prefer native Preact solutions.