domains / app-frameworks / novuhq/novu
Use semantic naming patterns
Establish consistent naming conventions that preserve semantic meaning and follow established patterns. Use descriptive names that clearly indicate purpose and type.
Establish consistent naming conventions that preserve semantic meaning and follow established patterns. Use descriptive names that clearly indicate purpose and type.
Key guidelines:
- Suffix enums with “Enum” for consistency:
SeverityLevelEnuminstead ofSeverityLevel - Prefix boolean functions with semantic indicators:
shouldLogAnalytics()instead ofisLogAnalytics() - Use semantic names in iterations:
map((variable) => ...)instead ofmap((error) => ...) - Avoid confusing terms in class names:
WorkflowStepFetcherinstead ofStepTemplateFetcher - Preserve original casing in user-facing suggestions: use
searchTextinstead ofsearchLowerfor variable name suggestions - Maintain consistent parameter naming across similar functions: stick to
workflowIdrather than mixingworkflowIdOrInternalId
Example:
// Good
export enum SeverityLevelEnum { ... }
function shouldLogAnalytics(): boolean { ... }
invalidVariables.map((variable) => ({ message: variable.name }))
// Avoid
export enum SeverityLevel { ... }
function isLogAnalytics(): boolean { ... }
invalidVariables.map((error) => ({ message: error.name }))
This ensures code is self-documenting and maintains consistency across the codebase.