Maintain consistent naming conventions throughout the codebase to improve readability and reduce confusion. Adhere to these guidelines: 1. **Function naming patterns**: Use established prefixes like `create` for factory functions, which accurately conveys their purpose and aligns with existing patterns.
Maintain consistent naming conventions throughout the codebase to improve readability and reduce confusion. Adhere to these guidelines:
create
for factory functions, which accurately conveys their purpose and aligns with existing patterns.
// Preferred
const counter = createCounter('api.calls', { service: 'web' });
const timer = createTimer('api.request.duration', { service: 'web' });
// Avoid
const counter = counter('api.calls', { service: 'web' });
// Preferred (instance method)
blockList.fromJSON(value)
// Avoid (incorrect capitalization for instance method)
BlockList.fromJSON(value)
Semantic specificity: Choose specific method names that prevent collisions and clearly communicate purpose. Avoid overly generic names like use()
when more descriptive alternatives like useEventListener()
or addDisposableEventListener()
are clearer.
Domain-consistent terminology: Use consistent terminology across related APIs. For example, if most of your file system API uses “file descriptor” or “fd”, maintain that terminology throughout rather than using alternatives like “handle” for the same concept.
Consistent naming makes codebases easier to learn, navigate, and maintain while reducing cognitive load for developers.
Enter the URL of a public GitHub repository