Thank you for your interest in contributing to @calphonse/logger! This document provides guidelines and information for contributors.
- Node.js >= 20.0.0
- pnpm >= 8.15.0
-
Fork and clone the repository
git clone https://github.com/your-username/logger.git cd logger -
Install pnpm (if not already installed)
npm install -g pnpm
-
Install dependencies
pnpm install
-
Set up pre-commit hooks (optional but recommended)
pnpm prepare
pnpm dev- Start development mode with watchpnpm build- Build the projectpnpm test- Run testspnpm test:watch- Run tests in watch modepnpm test:coverage- Run tests with coveragepnpm lint- Check for linting issuespnpm lint:fix- Fix linting issues automaticallypnpm format- Format codepnpm check- Run both linting and formatting checkspnpm check:fix- Fix both linting and formatting issuespnpm type-check- Run TypeScript type checkingpnpm clean- Clean build artifacts
This project uses Biome for linting and formatting. Biome is a fast formatter and linter that replaces ESLint and Prettier.
Always run these commands before committing your changes:
# Fix all linting and formatting issues
pnpm check:fix
# Run tests to ensure nothing is broken
pnpm test
# Type check to ensure TypeScript is happy
pnpm type-checkFor the best development experience, install the Biome extension for your IDE:
- VS Code: Biome
- Vim/Neovim: nvim-biome
- Other editors: Check the Biome documentation
- Write tests for new features and bug fixes
- Ensure all tests pass before submitting a PR
- Aim for good test coverage
- Use descriptive test names
- All code should be written in TypeScript
- Use strict TypeScript settings
- Provide proper type definitions
- Avoid using
anytype when possible
-
Ensure your code follows the project's style guidelines
pnpm check:fix
-
Run the full test suite
pnpm test pnpm test:coverage -
Check TypeScript types
pnpm type-check
-
Update documentation if you've added new features or changed existing APIs
Please include:
- A clear description of the changes
- The problem being solved (if applicable)
- Any breaking changes
- Screenshots or examples (if UI-related)
- Related issue numbers
Follow conventional commit format:
type(scope): description
[optional body]
[optional footer]
Examples:
feat(logger): add support for custom log levelsfix(types): correct return type for logger.child()docs(readme): update installation instructions
- Use meaningful variable and function names
- Keep functions small and focused
- Add comments for complex logic
- Follow the existing code patterns
- Use interfaces for object shapes
- Prefer
constoverletwhen possible - Use type guards for runtime type checking
- Avoid type assertions unless necessary
- Keep the logger API simple and intuitive
- Maintain backward compatibility when possible
- Consider performance implications
- Ensure proper error handling
When reporting issues, please include:
- Node.js version
- pnpm version
- Operating system
- Steps to reproduce
- Expected vs actual behavior
- Error messages (if any)
- Code examples (if applicable)
- Check existing issues and PRs
- Read the documentation
- Ask questions in discussions
- Join the community
By contributing to this project, you agree that your contributions will be licensed under the MIT License.