Wrote draft of project conventions

This commit is contained in:
2023-12-06 12:42:01 +01:00
parent 307e732608
commit 47151e83db

View File

@@ -1,4 +1,4 @@
# new-frontend
# Modern frontend for Release 11 Tools
This template should help get you started developing with Vue 3 in Vite.
@@ -44,3 +44,31 @@ npm run build
```sh
npm run lint
```
## Structure of Vuejs 3 components and views in this project
For this document's needs components and views will be named "modules" even though this is not a correct term for these files officialy.
### Main structure
Each file should start with \<script\> tag followed by \<template\> tag. If \<style\> tag is used (which should be avoided, this project uses Tailwind CSS for styling) it should be placed at the end of the file.
### Scripts
Elements should be placed in this order:
- Props - constant defined by defineProps function
- Emits - constant defined by defineEmits function
- Refs - contstans defined by ref functions with appropriate values
- Other functions
Rules regarding functions:
- Functions ought to have descriptive name
- Ought to do one thing. ie. function fetchRequest should send request, but not prepare request body
- In practice, if function has more than 10 SLoC, it probably should be split
- DO NOT use "any" type. Just don't.
- Function used in current function should be placed below it (if posible, as function can be called from many places in the code)
-
Rules regarding variables and refs:
-