From bb12d363c41b736cb365b380882d866915c179b1 Mon Sep 17 00:00:00 2001 From: Abizrh Date: Wed, 13 Aug 2025 16:57:53 +0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=96=20docs=20(readme):=20add=20code=20?= =?UTF-8?q?conventions=20and=20important=20note?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index fc6ea8d8..054f28c5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,10 @@ RSSA - Front End + +> [!IMPORTANT] +> Read this following instructions before doing your job + ## Framework Guide - [Vue Style Guide](https://vuejs.org/style-guide) @@ -58,6 +62,26 @@ The basic development workflow follows these steps: - Pages load the appropriate flow from `components/flow/`. - They do not contain UI or logic directly, just route level layout or guards. +## Code Conventions + +- Under the script setup block, putting things in group with the following order: + - Imports → all dependencies, sorted by external, alias (~), and relative imports. + - Props & Emits → clearly define component inputs & outputs. + - State & Computed → all ref, reactive, and computed variables grouped together. + - Lifecycle Hooks → grouped by mounting → updating → unmounting order. + - Functions → async first (fetching, API calls), then utility & event handlers. + - Watchers → if needed, put them at the bottom. + - Template → keep clean and minimal logic, use methods/computed instead of inline JS. +- Declaration Naming + - Uses PascalCase for `type` naming + - Uses camelCase for `variable` and `const` naming + - Underscore can be used to indicates that a variable has derived from an attribute of an object
+ for example: `person_name` indicates it is an attribute `name` from object `person` +- Looping + - Uses `i`, `j`, `k` as variable for `for` looping index + - Uses `item` as object instantition for `forEach` loop callback + - Uses `item` as object instantition for `v-for` loop callback in the template + ## Git Workflows The basic git workflow follows these steps: