23 lines
765 B
Markdown
23 lines
765 B
Markdown
# Code Style
|
|
- You never use comments
|
|
- We use `npm i @stdlib/string-format` for formatting strings. Always. Install if not yet done.
|
|
- We always use NUXT's useFetch
|
|
- We always use feature first packaging. Every class that is part of a entity is in its own folder
|
|
- We always define types like this (image/Image.ts):
|
|
```typescript
|
|
export interface Image {
|
|
id: string;
|
|
name: string;
|
|
tags?: Tag[];
|
|
}
|
|
```
|
|
- And a types API like this (image/ImageAPI.ts):
|
|
```typescript
|
|
export class ImageAPI {
|
|
static getAll() {
|
|
return useFetch<Image[]>('/api/images/', { server: false });
|
|
}
|
|
}
|
|
```
|
|
- We put sections/components that are part of a pages into its own dedicated folder inside ./components
|
|
- Always identify snippets of code that can be extracted |