Contributing
First off, thank you for considering contributing to zod-validation-error! Source code contributions, bug reports, and feature requests are most welcome.
To ensure the project remains stable, consistent, and easy to maintain, please follow the guidelines outlined below.
Development Environment
This project enforces specific Node versions and uses standard tooling for building, linting, and testing.
- Node.js: The project relies on an
.nvmrcfile which specifies Nodev24. Please ensure you are using this version (e.g., by runningnvm use). - Package Manager: We exclusively use
npm. Do not useyarnorpnpmto generate lockfiles, aspackage-lock.jsonis the source of truth.
Initial Setup
- Clone the repository.
-
Use the correct Node version:
nvm use -
Install dependencies:
npm ci
Note: When you install dependencies, a prepare script will automatically run, setting up husky git hooks for pre-commit linting and commit message validation.
Architecture & Scripts
Because this library supports both Zod v3 and v4, the source code inside lib/ is explicitly split into v3/ and v4/ subdirectories. Ensure you are applying changes to the correct directory, or both if the bug/feature applies universally.
The package.json provides several utility scripts:
npm run build: Bundles the code usingtsup. It generates both CommonJS and ESM artifacts and outputs them to the root/v3and/v4directories.npm run test: Runs the test suite usingvitest. We rely heavily on snapshot testing for exact string matching.npm run typecheck: Runstsc --noEmitto verify type integrity without outputting files.npm run lint: Lints thelib/directory using ESLint.npm run format: Formats code globally using Prettier.
Submitting Changes
- Branching: Create a descriptive feature branch from
main(e.g.,feat/add-new-optionorfix/handle-null-issue). - Implementation: Implement your feature or bug fix.
- Testing: Write tests for your changes. If altering string outputs, update the vitest inline snapshots carefully. Ensure tests pass (
npm run test) and typechecks succeed (npm run typecheck). - Committing: Commit your changes using Conventional Commits. Husky and
@commitlintwill verify the format of your commit message automatically. - Pull Request: Open a Pull Request against the
mainbranch. Provide a clear description of the problem and your solution.
Release Process (Changesets)
This project uses Changesets for versioning, changelog generation, and NPM publishing.
If your Pull Request introduces user-facing changes, bug fixes, or new features:
-
Run the changeset CLI:
npm run changeset -
Follow the prompts to select the bump type (major, minor, patch) and provide a summary of the changes.
- Commit the generated markdown file found in the
.changeset/folder alongside your code changes.
When your PR is merged, GitHub Actions will automatically aggregate the changesets and prepare a new Release PR.
We are hiring
Causaly is building the world's largest biomedical knowledge platform, using technologies such as TypeScript, React and Node.js. Find out more about our openings at https://jobs.ashbyhq.com/causaly.