Typ stylu TypeScript
type ComponentProps = {
styles: React.CSSProperties
}
Ofir Salem
type ComponentProps = {
styles: React.CSSProperties
}
Casing:
Long: easier to read throug in lists
MACRO_CASE: constants, enums
kebap-case: file names, paths
snake_case: API I/O, object properties, variables, function/method attributes.
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: functions, methods, GraphQL actions
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()`