Last active
October 5, 2022 07:37
-
-
Save stoyan-scava/d88c47fdb6ee757092f1f315df5aaa61 to your computer and use it in GitHub Desktop.
The common tongue of cloud typescript - an opinionated style guide
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Casing: | |
Long: easier to read throug in lists | |
MACRO_CASE: constants, enums | |
kebap-case: file names, paths | |
Short: less characters allow us to fit more meaning; e.g. when we extend or scope an entity (both good practices) the name tends to grow | |
camelCase: variables, function/method names, function/method attributes, GraphQL actions, API I/O, object properties | |
PascalCase for classes and interfaces, cloud infrastructure resource names | |
Grammar | |
variable: a noun (an object or a collection of objects) | |
function: a verb (an action) against a noun with optional adjunct (e.g. ...FromSomewhere, ...BySomeCriteria) | |
When the input attributes are more than two => nest them in a `config` object for readability. | |
Prefix private methods with an underscore to be easily distingushable from non-private methods. | |
interface: descirption of a noun and/or a verb | |
Not putting commas at the end ot each attribute make it an interface declaration easily distinguishable from a an object declaration | |
enum: a list of limited options | |
key - capital case with underscore | |
value - kebap case; If needed we can switch to short casing at any time with simple util like `toPascalCase()` | |
Imports | |
index.ts in libraries, not in projects | |
EXTERNAL REFERENCES: | |
- [Microsoft MakeCode Naming Conventions](https://makecode.com/extensions/naming-conventions) | |
- [Google TypeScript Style Guide](https://google.github.io/styleguide/tsguide.html) | |
- [NgRx Style Guide](https://github.com/orizens/ngrx-styleguide/blob/master/docs/actions.md) | |
- [Redux Style Guide](https://redux.js.org/style-guide/) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment