mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 12:21:41 +03:00
3.8 KiB
3.8 KiB
AFFiNE Code Guideline
Item | Specification | Example |
---|---|---|
Packages/Paths | aaa-bbb-ccc | ligo-virgo, editor-todo |
.tsx | PascalCase | AddPage.tsx |
.ts | kebab-case | file-export.ts |
.json | kebab-case | file-export.ts |
Domain File | OpenRules | xx.d.ts | tsconfig.xx.json | xx.spec .ts | .env.xx | yy-ds.ts |
Types | UpperCamelCase | WebEvent |
Enum variants | UpperCamelCase | Status{ Todo,Completed } |
Functions | lowerCamelCase | |
React Funciton Compoment | UpperCamelCase | function DocShare(){} |
React HOC | UpperCamelCase | function BussinessText(){} |
Function Parameter | lowerCamelCase | function searchByIdOrName(idOrname){ } |
Methods for external access | lowerCamelCase | public sayHello(){ }; |
Externally Accessible Variables (Variables) | lowerCamelCase | animal.sleepCount |
General constructors | constructor or with_more_details | |
Local variables | lowerCamelCase | const tableCollection = []; |
Statics | SCREAMING_SNAKE_CASE | GLOBAL_MESSAGES |
Constants | SCREAMING_SNAKE_CASE | GLOBAL_CONFIG |
Type parameters | UpperCamelCase , usually a single capital letter: T | let a: Animal = new Animal() |