#
Naming Conventions
#
Variable naming
Following our mantra, "code is for humans", variable names should be chosen with a priority on clear communication.
- Avoid unnecessary abbreviations. Example:
changeRequestDatais better thancrData. - Don't use just
dataas a variable name. Saying something is "data" tells us nothing about what it actually means. Try to find a more descriptive or meaningful name. Adjust verbosity depending on the variable's longevity/scope. Longer-lived variables should have more descriptive names; narrowly-scoped variables can have appropriately brief names.
- Example:
.find(u => u.id === user.id)is acceptable becauseuis only in scope for that line or a small block. - Variables that live in very large scopes should be named as descriptively as possible.
- Example: