This is the Effect library repository, focusing on functional programming patterns and effect systems in TypeScript.
- The git base branch is
main - Use
pnpmas the package manager
- Zero Tolerance for Errors: All automated checks must pass
- Clarity over Cleverness: Choose clear, maintainable solutions
- Conciseness: Keep code and any wording concise and to the point. Sacrifice grammar for the sake of concision.
- Reduce comments: Avoid comments unless absolutely required to explain unusual or complex logic. Comments in jsdocs are acceptable.
- Run
pnpm lint-fixafter editing files - Always run tests after making changes:
pnpm test run <test_file.ts> - Run type checking:
pnpm check- If type checking continues to fail, run
pnpm cleanto clear caches, then re-runpnpm check
- If type checking continues to fail, run
- Build the project:
pnpm build - Check JSDoc examples compile:
pnpm docgen
Always look at existing code in the repository to learn and follow established patterns before writing new code.
Do not worry about getting code formatting perfect while writing. Use pnpm lint-fix
to automatically format code according to the project's style guidelines.
The index.ts files are automatically generated. Do not manually edit them. Use
pnpm codegen to regenerate barrel files after adding or removing modules.
All pull requests must include a changeset in the .changeset/ directory.
This is important for maintaining a clear changelog and ensuring proper versioning of packages.
If you need to run some code for testing or debugging purposes, create a new
file in the scratchpad/ directory at the root of the repository. You can then
run the file with tsx scratchpad/your-file.ts.
Make sure to delete the file after you are done testing.
Before writing tests, look at existing tests in the codebase for similar functionality to follow established patterns.
- Test files are located in
packages/*/test/directories for each package - Main Effect library tests:
packages/effect/test/ - Always verify implementations with tests
- Run specific tests with:
pnpm test <filename>
- Use
it.effectfor all Effect-based tests, notEffect.runSyncwith regularit - Import
{ assert, describe, it }from@effect/vitest - Never use
expectfrom vitest in Effect tests - useassertmethods instead - All tests should use
it.effect("description", () => Effect.gen(function*() { ... }))
Before writing tests, look at existing tests in the codebase for similar functionality to follow established patterns.
If you need to learn more about the new version of effect (version 4), you can access the repository here:
`.repos/effect-v4`