Skip to content

Latest commit

 

History

History
146 lines (118 loc) · 3.91 KB

File metadata and controls

146 lines (118 loc) · 3.91 KB

Contributing to @asouei/safe-fetch

Thanks for your interest in contributing! We welcome issues, discussions, and pull requests.

Quick Start

  1. Fork the repository on GitHub
  2. Clone your fork:
    git clone https://github.com/<your-username>/safe-fetch.git
    cd safe-fetch
  3. Install dependencies:
    pnpm install
  4. Run tests to make sure everything works:
    pnpm -r test

Development Workflow

Code Style & Standards

  • Use TypeScript and follow the existing code patterns
  • Format code with Prettier (runs automatically on commit)
  • Follow conventional naming: camelCase for functions/variables, PascalCase for types
  • Keep functions focused and well-documented

Testing Requirements

  • All new features must include tests using Vitest
  • Aim for high test coverage of new code paths
  • Test both success and error scenarios
  • Mock external dependencies appropriately

Before Submitting

  1. Run the test suite:
    pnpm -r test
  2. Check TypeScript compilation:
    pnpm -r build

Submitting Changes

Issues First

For significant changes, please open an issue first to discuss:

  • New features or breaking changes
  • Performance improvements
  • API modifications

Pull Request Process

  1. Create a feature branch from master:
    git checkout -b feature/your-feature-name
  2. Make atomic commits with clear, descriptive messages:
    git commit -m "feat: add retry delay jitter support"
  3. Update documentation if behavior changes:
    • README.md for user-facing changes
    • JSDoc comments for API changes
    • Add examples for new features
  4. Add yourself to CHANGELOG.md under "Unreleased" if you want credit
  5. Push and create a pull request with:
    • Clear title describing the change
    • Description of what changed and why
    • Reference any related issues

CI Requirements

All pull requests must pass:

  • ✅ TypeScript compilation (pnpm -r build)
  • ✅ Test suite (pnpm -r test)
  • ✅ Linting (pnpm -r lint)
  • ✅ No conflicting dependencies

Project Structure (Monorepo)

packages/
├── core/                    # @asouei/safe-fetch
│   ├── src/
│   │   ├── index.ts        # Main export and createSafeFetch  
│   │   ├── types.ts        # TypeScript definitions
│   │   ├── errors.ts       # Error constructors and utilities
│   │   └── type-guards.ts        # Helper functions
│   ├── tests/              # Test files
│   └── package.json
└── react-query/            # @asouei/safe-fetch-react-query
    ├── src/
    └── package.json

Working on Core Library

cd packages/core
pnpm build
pnpm test

Working on React Query Adapter

cd packages/react-query
pnpm build
pnpm test

Common Contribution Areas

Bug Fixes

  • Check existing issues first
  • Include reproduction steps in your PR
  • Add regression tests

Feature Additions

  • Discuss design in an issue first
  • Keep features focused and composable
  • Update TypeScript types accordingly
  • Add comprehensive tests and docs

Documentation

  • Fix typos, improve clarity
  • Add missing JSDoc comments
  • Update README examples
  • Improve error messages

Getting Help

Code of Conduct

We follow the Contributor Covenant Code of Conduct.

TL;DR: Be respectful, helpful, and constructive. We're all here to build something useful together.


Thank you for contributing! Every improvement, no matter how small, helps make safe-fetch better for everyone.