This document outlines the naming conventions to be followed for files, folders, and variables in the monorepo-one
project. Consistent naming conventions help improve readability, maintainability, and collaboration within the project.
- Use
kebab-case
for filenames.- Example:
user-profile.ts
- Example:
- Use descriptive names that clearly indicate the purpose of the file.
- Example:
user-service.ts
instead ofservice.ts
- Example:
- Use
kebab-case
for folder names.- Example:
user-services
- Example:
- Group related files into folders based on their functionality or domain.
- Example:
services/user-services
- Example:
- Use
camelCase
for variable names.- Example:
userName
,totalPrice
- Example:
- Use descriptive names that clearly indicate the purpose of the variable.
- Example:
userAge
instead ofage
- Example:
- Use
PascalCase
for class names.- Example:
UserProfile
,ShoppingCart
- Example:
- Use descriptive names that clearly indicate the purpose of the class.
- Example:
OrderService
instead ofService
- Example:
- Use
UPPER_CASE
for constants.- Example:
MAX_USERS
,DEFAULT_TIMEOUT
- Example:
- Use descriptive names that clearly indicate the purpose of the constant.
- Example:
MAX_RETRIES
instead ofRETRIES
- Example:
- Use
camelCase
for function names.- Example:
calculateTotal
,getUserById
- Example:
- Use descriptive names that clearly indicate the purpose of the function.
- Example:
fetchUserData
instead offetchData
- Example:
- Use
PascalCase
for interfaces and type definitions.- Example:
UserProfile
,OrderDetails
- Example:
- Use descriptive names that clearly indicate the purpose of the interface or type.
- Example:
UserAddress
instead ofAddress
- Example:
- Avoid abbreviations and acronyms unless they are well-known and widely accepted.
- Example:
HTMLParser
instead ofHP
- Example:
- Be consistent with naming conventions throughout the project.
- Regularly review and update naming conventions as the project evolves.
By following these naming conventions, we can ensure that our codebase remains clean, readable, and maintainable. Consistent naming conventions also facilitate collaboration and make it easier for new team members to understand the code.