Thank you for your interest in contributing to FormKit Gov! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Making Changes
- Commit Guidelines
- Pull Request Process
- Testing
- Documentation
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
- Node.js >= 20.0.0
- pnpm >= 9.0.0
- Git
-
Fork the repository on GitHub.
-
Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/formkit-gov.git cd formkit-gov -
Add the upstream repository:
git remote add upstream https://github.com/LinnJS/formkit-gov.git
-
Install dependencies:
pnpm install
-
Build all packages:
pnpm build
-
Run tests to ensure everything is working:
pnpm test
formkit-gov/
├── packages/
│ ├── core/ # @formkit-gov/core - Zod schemas & utilities
│ ├── react/ # @formkit-gov/react - React components
│ ├── store/ # @formkit-gov/store - State management
│ ├── wizard/ # @formkit-gov/wizard - Multi-step forms
│ ├── openapi/ # @formkit-gov/openapi - OpenAPI integration
│ ├── validators/ # @formkit-gov/validators - Extended validators
│ └── test-utils/ # @formkit-gov/test-utils - Testing utilities
├── docs/ # Internal documentation
└── ...config files
Create a branch for your changes:
git checkout -b <type>/<scope>/<description>Examples:
feat/react/add-date-pickerfix/core/ssn-validationdocs/wizard/update-examples
-
Make your changes in the appropriate package(s).
-
Run the development server:
# Run all packages in watch mode pnpm dev # Run a specific package pnpm --filter @formkit-gov/react dev
-
Test your changes:
# Run all tests pnpm test # Run tests for a specific package pnpm --filter @formkit-gov/react test # Run tests in watch mode pnpm test:watch
-
Ensure linting passes:
pnpm lint pnpm typecheck
-
Format your code:
pnpm format
We follow Conventional Commits. Each commit message should have a type, optional scope, and description.
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, semicolons, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding or updating testsbuild: Build system changesci: CI/CD changeschore: Other changes (dependencies, configs)revert: Reverting a previous commit
core,react,store,wizard,openapi,validators,test-utilsdocs,storybook,playgrounddeps,release,repo
feat(react): add TextInputField component
fix(core): correct SSN regex pattern for edge cases
docs(wizard): add save-in-progress guide
chore(deps): update zod to v3.23-
Create a changeset if your PR includes user-facing changes:
pnpm changeset
Follow the prompts to describe your changes.
-
Update documentation if needed.
-
Ensure all checks pass:
- Linting
- Type checking
- Tests
- Build
-
Submit your PR with a clear title and description.
-
Address review feedback promptly.
Follow the same format as commit messages:
<type>(<scope>): <description>
Your PR description should include:
- Summary of changes
- Related issue(s)
- Testing performed
- Screenshots (for UI changes)
- Breaking changes (if any)
# All tests
pnpm test
# With coverage
pnpm test:coverage
# Watch mode
pnpm test:watch
# Specific package
pnpm --filter @formkit-gov/react test- Place test files next to the source files with
.test.tsor.test.tsxextension. - Use descriptive test names.
- Test both happy paths and edge cases.
- Include accessibility tests for components.
Example:
import { describe, it, expect } from 'vitest';
import { createSSNSchema } from './ssn';
describe('createSSNSchema', () => {
const schema = createSSNSchema();
it('validates correctly formatted SSN', () => {
expect(schema.safeParse('123-45-6789').success).toBe(true);
});
it('rejects SSN without dashes', () => {
const result = schema.safeParse('123456789');
expect(result.success).toBe(false);
});
it('provides user-friendly error message', () => {
const result = schema.safeParse('invalid');
expect(result.error?.issues[0].message).toContain('Social Security');
});
});Each package should have:
- README.md with usage examples
- JSDoc comments for public APIs
- Storybook stories for components
Internal documentation is in the docs/ directory. For package usage documentation, see each
package's README.
If you have questions, feel free to:
- Open a Discussion
- Check existing Issues
Thank you for contributing!