-
Notifications
You must be signed in to change notification settings - Fork 0
Naming Convention
Our naming convention is inspired by BEM with the form [entity]-[feature]--[modifier]
.
entity
: node, model, react etc.
feature
: guards, enum, factory, repository, service etc
modifier
: create, model, react
modifier
could be an entity
depending on the context.
Let's say we are creating guards for our node. Since node contains subtypes we can name like this
node-guards--model.ts
node-guards--react.ts
We want to put the modifier at the end, if we are naming a react node. We will do
NodeReact
instead of ReactNode
. The commonality should be at the front so it lines up better when we have a list
NodeReact
NodeTree
NodeModel
If we have input (I) and working type (A), we can do
NodeReactI
NodeReactA
NodeTreeI
NodeTreeA
NodeModelI
NodeModelA
For our project, it felt redundant to prefix with Node
or Dto
, since it is the same for all subtypes. As of now we went with
Basetype:
NodeI
NodeA
Subtype:
ReactI
ReactA
ModelI
ModelA
Enums contain Type
in the variable. NodeType
, ReactType
, ModelType
.
We also have the literal version of types, which is a string union.
type ModelTypeLiteral = 'model' | 'schema'
Footer