-
Notifications
You must be signed in to change notification settings - Fork 0
Naming Conventions
The Conventional Commits specification is a lightweight convention for commit messages. It provides a clear set of rules that make commit history more readable and enable automated tooling. It also ties directly into Semantic Versioning (SemVer), helping determine whether a change is a patch, minor, or major release.
Refer to Conventional Commits methodology.
<type>[optional scope]: <description> (Related Commit #)
[optional body]
[optional footer(s)]-
type: the kind of change (e.g.,
fix,feat,docs, etc.) - scope (optional): a contextual label in parentheses (e.g., feat(parser): ...)
- description: a short summary of the change
- body (optional): more details about the change
-
footer(s) (optional): metadata such as
BREAKING CHANGEor references
- fix: patches a bug (correlates with PATCH in SemVer)
- feat: introduces a new feature (correlates with MINOR in SemVer)
- chore: any non functional changes in the code (ex: linting, formatting)
- docs: addition or modification of documentation
- refactor:
- test:
- BREAKING CHANGE: indicates an API-breaking change (correlates with MAJOR in SemVer)
- Simple feature:
feat: allow config object to extend other configs (#5, #9)- Commit with Body and Issue Reference
fix: prevent racing of requests (#13)
Introduce request id and dismiss responses other than the latest request.
Refs: #123Consult the Expo Documentation to learn how to name the frontend's routes.
- Expo Router Notation: https://docs.expo.dev/router/basics/notation/
- Expo Router Layout: https://docs.expo.dev/router/basics/layout/
PascalCase
This is the standard for React components, making them instantly recognizable.
- Component file:
UserProfile.tsx - Component name:
function UserProfile() { ... }
kebab-case
For directories containing component files, use the name of the component.
- Example:
app/components/user-profile/which containsindex.tsandUserProfile.tsx
camelCase
For hooks, utilities, services, and other non-component files.
- Hooks:
useAuthentication.ts - API services:
flightApi.ts - Utilities:
dateFormatter.ts
camelCase
This is the standard for JavaScript and TypeScript.
const currentUser = 'John';function getUserFlights() { ... }
UPPER_SNAKE_CASE for values that are static and never change.
const API_TIMEOUT = 5000;enum UserRole { ADMIN, GUEST }
Since NativeWind uses utility classes directly in the className prop, there are no variables to name. If you abstract styles into objects, use camelCase for the keys.
const styles = {
cardContainer: "p-4 bg-white rounded-lg shadow-md",
titleText: "text-xl font-bold text-gray-800",
};camelCase
- Routes:
userRoutes.ts - Services:
notificationService.ts - Middleware:
requireAuth.ts
(kebab-case exceptions allowed for external libraries)
camelCase
let activeConnections = 0;async function processWebhook() { ... }
PascalCase
class DatabaseService { ... }class DrizzleUserRepo { ... }
Follow RESTful principles. Use plural nouns and kebab-case for paths.
- Collection of resources:
GET /api/users - Specific resource:
GET /api/users/:userId - Nested resource:
GET /api/users/:userId/flight-history
Plural and snake_case
A table represents a collection of records.
usersflight_alertsuser_profiles
Singular and snake_case
first_namecreated_atlast_login_ip
Simply id. It's a simple, universal standard.
{singular_table_name}_id
This convention makes relationships obvious.
- The
flight_alertstable would have auser_idcolumn to reference theuserstable.
Combine the two table names in alphabetical order, separated by an underscore.
- To link
usersandroles(many-to-many):roles_users
idx_{table_name}_{column_names}
This provides clarity on what the index is for.
idx_users_emailidx_flight_alerts_user_id_departure_time