Thank you for considering contributing to our Next.js front-end project! This document outlines our coding standards and commit conventions.
Install dependencies:
npm installWe use ESLint and Prettier to maintain consistent code quality and formatting.
- Follows Next.js core web vitals recommendations
- Warns on unused variables
- Warns on console statements
- Enforces Prettier formatting rules
- Uses tabs for indentation
- Tab width: 2 spaces
- Print width: 80 characters
- Single quotes (default)
- Uses trailing commas (ES5)
- Includes spaces in brackets
JavaScript/TypeScript (.js, .ts)
- Tab width: 4 spaces
- Double quotes
React TSX (.tsx)
- No semicolons
- Default tab width (2)
JSON/JSONC Files
- Tab width: 4 spaces
- Double quotes
Markdown Files
- Always wrap prose
We follow a industry-standard commit message format to maintain a clean git history.
<type>(<scope>): <subject>
or
<type>: <subject>
You can use these types for git commit message:
feat: New featuresfix: Bug fixesdocs: Documentation changesstyle: Code style/formattingrefactor: Code refactoring (code changes that neither add new feature nor fix a bug)test: Adding/updating testschore: Maintenance tasksperf: Performance improvementsci: CI configuration changesbuild: Build system changesrevert: Revert previous changes
- Type must be lowercase
- Scope is required and must be lowercase
- Subject must be lowercase
- No period at the end of subject
- Subject cannot be empty
Valid commits:
feat(auth): add google login
fix(navbar): resolve dropdown issue
style(navbar): update navbar background color
docs(readme): update installation steps
Invalid commits:
Feat: Add feature # Wrong casing (uppercase is not allowed to type)
fix: fixed bug. # Has period
chore: # Empty subject
fix typo # Empty type
The project uses Husky and lint-staged to run checks before commits:
- Code formatting and linting will run automatically on staged files
- Commit messages will be validated against our convention rules
If any of these checks fail, your commit will be blocked until the issues are resolved. In case of failure, view command output to see and fix all violations.