👍🎉 First off, thanks for taking the time to contribute! 🎉👍
The following is a set of guidelines for contributing to Farfetched. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
Any new feature or change should be discussed with maintainers via issue with RFC. It will help to avoid unnecessary work and make sure that the feature will be accepted. RFCs are accepted in English and Russian languages.
After discussion, RFC should be transformed to an ADR in the apps/website/adr
directory. It will be a part of the documentation. ADRs are accepted in English only.
Any new feature or change should be documented. It is a part of the feature itself. Documentation should be placed in the apps/website/docs
directory. It is written in Markdown and accepted in English only.
Any new feature or change should be covered by tests. It is a part of the feature itself. Tests have to cover runtime implementation and TypeScript types declarations. Farfetched uses Vitest as a test runner, please refer to its documentation for more information.
After documentation and tests are ready, you can start implementing the feature. Please ensure that your implementation is passing all checks. You can run them via pnpm ci:local
to get quicker feedback than CI.
After implementation is ready, you have to fill in changes via pnpm changeset
. It will create a new changeset in the .changeset
directory. Changesets are accepted in English only. It will be used for versioning and changelog generation.
While writing RFC, keep in mind that the new API (or changes in the existing API) should be consistent with the following principles:
- Solve a real problem. The new feature should solve a real problem that is faced by developers. You have to provide a clear example of the problem and how the new feature solves it.
- Be consistent. The new feature should be consistent with the existing API. It should not introduce new concepts or patterns that are not used in the existing API unless it is necessary.
- Simple solutions for simple problems, complex solutions for complex problems. Not vice versa.
Read existing ADRs to get an understanding of the existing API and principles.
While writing code, keep in mind that Farfetched is a library that is focused on developer and user experiences. Moreover, Farfetched is based on Effector and has to be consistent with its principles and APIs. There are some tips that will help you to create a good implementation:
- Fork API is a key. Any feature should support Fork API.
- Performance is important. Avoid unnecessary computations and slow algorithms.
- TypeScript is a must. Ensure that your implementation is typed correctly.
- Declarative API > Imperative API. Users should be able to express the logic of a computation without describing its control flow using your feature.
- Respect
.nvmrc
file. We cannot guarantee that Farfetched will work with other Node.js versions. - Respect
packageManager
field inpackage.json
. - Keep PRs on-topic. If you want to introduce two unrelated changes, please create two separate PRs.