- backend: Deno
- frontend: Preact, preact signals, Tailwind v4+, DaisyUI 5
- build using vite
- Check for useless
try / catchthat simply re-throw the error without handeling anything - Check for useless
async / awaitthat could be simply handled by returningasync () { return await asyncCall() }should be() => asyncCall() - Never use
.forEachunless the function called in the loop already exists, usefor .. ofinstead - Check that
.mapis return value is used - Check for useless wrapper function
onclick={() => handleClick()}should beonclick={handleClick} .reduceis to be avoided aside from very simple accumulation that do not imply re-spreading / object creation. Valid cases are total, descending a tree, chaining promises .then, suggestfor .. ofinstead, if the goal was to recreate an object, suggest to.mapto entries and useObject.fromEntrieslike so:Object.fromEntries(xx.map(x => [x.k, x.v]))instead.- Never use
for .. in, usefor .. ofwithObject.keys/Object.entriesorObject.values - Enum / switch type recommandation: In switch cases over enums, make sure we
have an exhaustive check in the
defaultcase:or require a comment justifying why all the case are not needed.switch (e /* enum value*/ ) { case (E.A): break; case (E.B): break; default: { const _: never = e; // Ensure all cases are handled } - Code Format:
- indent: 2 spaces
- line width: 80 chars
- no semi-colons
- favor single quote
Most code is custom, library are avoided as much as possible. For the backend, if needed, rely on https://jsr.io/@std for external libraries only.
- Always prompt to remove
console.logif the log need to stay, they must use our own log librarylog.info - Our own log library first argument is always the name of the event, it is a simple string, without spaces if possible static.
- Errors are automatically handled and can be passed a simple props of the
second argument, Example:
log.warn('unable-to-reach-instance', { error: err, instanceId: 56 })
- We try to use url params as the main source of state through a custom signal
url.params - Avoid hooks and state in components
- Favor modern html standard and avoid redefining what's already available in
the browser (example, & +
tags)
- Signals in components
- make sure we never create signals unless we use
useSignaland still, suggest alternatives using computed signals outside of the component function. - Look for un-necessary
useEffectsthat could simply be conditional values (ternary for examples) or achieved using signals outside of the component
- make sure we never create signals unless we use
This project does not use any database, instead due to the limited data it needs to handle, a simple JSON file store was created.
- All the data lives in memory and is loaded on startup.
- Any creation or modification are persisted to the respective files