Choose variable, function, and class names that accurately reflect their purpose while maintaining consistency with established patterns in the codebase. When the purpose or content of an entity changes, update its name accordingly. This applies to:
Choose variable, function, and class names that accurately reflect their purpose while maintaining consistency with established patterns in the codebase. When the purpose or content of an entity changes, update its name accordingly. This applies to:
// After: More general name that matches its versatile purpose function getHash(input: string): string { … }
2. **Variable names**: Ensure names accurately reflect the actual content.
```javascript
// Before: Misleading name (contains ids, not urls)
const normalizedAcceptedUrls = new Set<string>()
// After: Name matches content
const resolvedAcceptedDeps = new Set<string>()
// After: Plural form indicating multiple modules public fileToModulesMap = new Map<string, ModuleRunnerNode[]>()
4. **Parameter names**: Choose names that avoid confusion with similar concepts.
```javascript
// Before: Potentially confusing parameter name
function glob(pattern: string, cwd: string): string[] { ... }
// After: More specific name that avoids confusion
function glob(pattern: string, base: string): string[] { ... }
// After: Follows the project’s hyphenated naming pattern { name: ‘ember-app’, // … } ```
Always prioritize clarity and accuracy in naming to improve code readability and reduce the likelihood of bugs or misunderstandings.
Enter the URL of a public GitHub repository