Casing
| Style | ประเภทตัวแปร |
|---|---|
| PascalCase | class |
| interface | |
| type | |
| enum | |
| ชื่อ component | |
| ------------- | -------------- |
| camelCase | variable |
| argument | |
| parameter | |
| function | |
| method | |
| ------------- | -------------- |
| CONSTANT_CASE | global const |
| ------------- | -------------- |
| kebab-case | ชื่อ folder |
| ชื่อ file |
รายละเอียดเพิ่มเติม
-
+MUST ต้องใส่ comment กำกับ หากมีความหมายกำกวม, เข้าใจยาก, หรือ ไม่สามารถเข้าใจได้
-
-MUST ไม่ใช้คำย่อที่ไม่เป็นสากล หรือ ย่อโดยไม่จำเป็น
✔️ ทำ
const index const errorCount const dnsConnection // "dns" เป็นคำย่อที่รู้จักกันโดยทั่วไปสำหรับผู้ที่เป็น programmer/developer❌ ไม่ทำ
const idx // ไม่ใช่ทุกคนที่จะเข้าใจ const errCount const dnsConn // "Conn" คือ ? -
-MUST ไม่ใช้คำย่อที่ต้องมีการตีความ หรือ คาดเดา
✔️ ทำ
const customerId const kilometer // เป็นหน่วย SI แต่ก็ไม่ควรย่อ เนื่องจากป้องกันการสับสน❌ ไม่ทำ
const cstmrId // "cstmr" คือ ? const wgcConnections // "wgc" คือ ? const kSecondsPerDay // ไม่ใช่ทุกคนที่รู้ hungarian notation -> k