Thank you for your interest in contributing to Filter! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Development Workflow
- Testing
- Documentation
- Pull Request Process
- Coding Standards
By participating in this project, you agree to maintain a respectful and inclusive environment for all contributors.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/filter.git - Add upstream remote:
git remote add upstream https://github.com/mcabreradev/filter.git
pnpm install
pnpm test
pnpm test:watch
pnpm build
pnpm type-check
pnpm docs:devfilter/
├── src/ # Source code
│ ├── core/ # Core filter functionality
│ ├── operators/ # Operator implementations
│ ├── comparison/ # Comparison utilities
│ ├── config/ # Configuration
│ ├── integrations/ # Framework integrations (React, Vue, Svelte)
│ ├── predicate/ # Predicate functions
│ ├── types/ # TypeScript type definitions
│ ├── utils/ # Utility functions
│ └── validation/ # Validation schemas
├── __test__/ # Test files
├── docs/ # Documentation
├── examples/ # Usage examples
└── build/ # Build output
- Create a feature branch:
git checkout -b feature/your-feature-name - Make your changes
- Write/update tests
- Update documentation
- Run tests:
pnpm test - Run type checks:
pnpm type-check - Commit your changes following conventional commits
- Push to your fork
- Open a Pull Request
All new features and bug fixes must include tests:
pnpm test
pnpm test:coverage
pnpm test filter.test.tsType-level tests ensure TypeScript types work correctly:
pnpm test:types- Use descriptive test names
- Follow Arrange-Act-Assert pattern
- Test edge cases and error conditions
- Maintain 100% code coverage
Example:
describe('filter', () => {
it('should filter array by simple condition', () => {
const data = [{ age: 25 }, { age: 30 }];
const expression = { field: 'age', operator: 'gt', value: 26 };
const result = filter(data, expression);
expect(result).toEqual([{ age: 30 }]);
});
});- Add JSDoc comments for public APIs
- Include usage examples
- Document parameters and return types
Documentation is in the docs/ directory:
pnpm docs:dev
pnpm docs:buildWhen adding new features:
- Update relevant documentation pages
- Add examples to
docs/examples/ - Update API reference if needed
- Tests pass locally
- Code follows project style guidelines
- Documentation is updated
- Type checks pass
- No linter errors
- Commit messages follow conventional commits
## Description
[Describe your changes]
## Type of Change
- [ ] ✨ New feature
- [ ] 🛠️ Bug fix
- [ ] ❌ Breaking change
- [ ] 🧹 Code refactor
- [ ] 📝 Documentation
- [ ] 🗑️ Chore
## Testing
- [ ] Unit tests added/updated
- [ ] Type tests added/updated
- [ ] All tests pass
## Checklist
- [ ] Code builds successfully
- [ ] Documentation updated
- [ ] No TypeScript errors
- [ ] No linter issues- Maintainers will review your PR
- Address any feedback
- Once approved, your PR will be merged
- Use strict TypeScript mode
- Prefer
interfaceovertypefor objects - Avoid
any- use proper types - Use descriptive variable names
- Use functional programming patterns
- Follow DRY principle
- Keep functions small and focused
- Use meaningful names
camelCase- variables, functionsPascalCase- types, interfaces, classeskebab-case- file namesUPPERCASE- constants
feature/
├── feature.ts # Main implementation
├── feature.types.ts # Type definitions
├── feature.utils.ts # Utility functions
├── feature.constants.ts # Constants
└── feature.test.ts # Tests
When adding framework integrations:
- Follow framework best practices
- Maintain type safety
- Add comprehensive examples
- Update framework documentation
- Add integration tests
- Use memoization where appropriate
- Implement lazy evaluation for expensive operations
- Benchmark performance-critical changes
- Document performance characteristics
- Open an issue for questions
- Join discussions in GitHub Discussions
- Check existing issues and PRs
By contributing, you agree that your contributions will be licensed under the MIT License.