Skip to content

Commit 5fb5732

Browse files
docs: contributor docs (#1938)
1 parent 2155247 commit 5fb5732

20 files changed

Lines changed: 308 additions & 277 deletions

‎AGENTS.md‎

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
`@testing-library/react-native` is a TypeScript/Jest library for testing React Native components with user-focused testing patterns.
44

55
> [!IMPORTANT]
6-
> Never run git commands that create commits, push, or modify the index/history (`git commit`, `git push`, `git add`, `git rm`, `git reset`, `git rebase`, `git merge`, `git stash`, `git tag`, etc.). Only make working-tree changes and read-only git inspections; the human stages and commits. See [Git, releases, and PR workflow](agents/git-workflow.md).
6+
> Never run git commands that create commits, push, or modify the index/history. The human stages and commits. See [Agent rules](#agent-rules).
77
88
- Package manager: `yarn` (`yarn@4.11.0`)
99
- Common commands:
@@ -14,11 +14,31 @@
1414
- `yarn format:check`
1515
- `yarn build`
1616
- `yarn validate`
17-
- Task-specific guidance:
18-
- [Architecture and API design](agents/architecture.md)
19-
- [Build, validation, and repo layout](agents/build-and-validation.md)
20-
- [TypeScript and code style](agents/code-style.md)
21-
- [Testing conventions](agents/testing.md)
22-
- [Native event propagation (bubbling vs direct)](agents/native-events.md)
23-
- [Example app regeneration](agents/example-apps.md)
24-
- [Git, releases, and PR workflow](agents/git-workflow.md)
17+
- Contributor guides (shared with human contributors, see also [CONTRIBUTING.md](CONTRIBUTING.md)):
18+
- [Architecture and API design](contributing/architecture.md)
19+
- [Build, validation, and repo layout](contributing/build-and-validation.md)
20+
- [TypeScript and code style](contributing/code-style.md)
21+
- [Testing conventions](contributing/testing.md)
22+
- [Native event propagation (bubbling vs direct)](contributing/native-events.md)
23+
- [Native state for uncontrolled components](contributing/native-state.md)
24+
- [Event dispatch (`fireEvent` vs `userEvent`)](contributing/event-dispatch.md)
25+
- [Accessibility model](contributing/accessibility.md)
26+
- [Async, `act`, and timers](contributing/async-and-timers.md)
27+
- [Example app regeneration](contributing/example-apps.md)
28+
- [Git, releases, and PR workflow](contributing/git-workflow.md)
29+
30+
## Agent rules
31+
32+
### Git restrictions
33+
34+
- Never run git commands that create commits, push, or modify the index/history. The human owns these actions.
35+
- Forbidden commands include (non-exhaustive): `git commit`, `git push`, `git add`, `git rm`, `git mv`, `git restore --staged`, `git reset`, `git rebase`, `git merge`, `git cherry-pick`, `git stash`, `git commit --amend`, and `git tag`.
36+
- Read-only inspection is fine: `git status`, `git log`, `git diff`, `git show`, `git blame`.
37+
- When conflicts or staging are involved, resolve file contents in the working tree only, then hand off to the human to stage and commit. Describe the exact commands you would run instead of running them.
38+
39+
### PR draft
40+
41+
- Maintain `PR.txt` at the repository root using the structure from `.github/PULL_REQUEST_TEMPLATE.md`.
42+
- Keep `PR.txt` aligned with the current branch diff relative to `origin/main`.
43+
- Include tests actually run and any known validation gaps in `PR.txt`.
44+
- Do not commit `PR.txt`.

‎CONTRIBUTING.md‎

Lines changed: 19 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,25 @@ The core team works directly on GitHub and all work is public.
1414
1515
1. Fork the repo and create your branch from `main` (a guide on [how to fork a repository](https://help.github.com/articles/fork-a-repo/)).
1616
2. Run `yarn` to setup the development environment.
17-
3. Do the changes you want and test them out in the example app before sending a pull request.
18-
19-
### Commit message convention
20-
21-
We prefix our commit messages with one of the following to signify the kind of change:
22-
23-
- `fix`: bug fixes, e.g. fix incorrect error message.
24-
- `feat`: new features, e.g. add useful API.
25-
- `refactor`: code/structure refactor, e.g. new folder structure.
26-
- `docs`: changes into documentation, e.g. add usage example for `getByText`.
27-
- `test`: adding or updating tests, eg unit, snapshot testing.
28-
- `chore`: tooling changes, e.g. change circle ci config.
29-
- `BREAKING`: for changes that break existing usage, e.g. change API.
30-
31-
Our pre-commit hooks verify that your commit message matches this format when committing.
32-
33-
### Linting and tests
34-
35-
We use TypeScript for type checking, `eslint` and `oxfmt` for linting and formatting the code, and `jest` for testing. Our pre-commit hooks verify that the linter and tests pass when committing. You can also run the following commands manually:
36-
37-
- `yarn typecheck`: run TypeScript compiler on all files.
38-
- `yarn lint`: run eslint.
39-
- `yarn test`: run tests.
40-
41-
### Sending a pull request
42-
43-
When you're sending a pull request:
44-
45-
- Prefer small pull requests focused on one change.
46-
- Verify that `typecheck`, `eslint` and tests are passing.
47-
- Preview the documentation to make sure it looks good.
48-
- Follow the pull request template when opening a pull request.
49-
50-
### Publishing a release
51-
52-
We use [release-it](https://github.com/release-it/release-it) to publish a release. It takes care of versioning, changelog generation, and publishing to NPM.
53-
54-
```sh
55-
yarn release
56-
```
17+
3. Make your changes, add tests, and try them out in the example app.
18+
4. Run `yarn validate` to type check, test, lint, and check formatting. CI runs the same checks on your pull request.
19+
5. Open a pull request following the [pull request guidelines](contributing/git-workflow.md#pull-requests).
20+
21+
### Contributor guides
22+
23+
Detailed guides live in [`contributing/`](contributing/). They are written for both human contributors and AI coding agents:
24+
25+
- [Architecture and API design](contributing/architecture.md): project goals, API design principles, and host component detection
26+
- [Build, validation, and repo layout](contributing/build-and-validation.md): commands, package docs generation, folder structure
27+
- [TypeScript and code style](contributing/code-style.md): lint and formatting rules
28+
- [Testing conventions](contributing/testing.md): how the library's own tests are organized
29+
- [Native event propagation](contributing/native-events.md): which React Native events bubble and which are direct
30+
- [Native state](contributing/native-state.md): how RNTL simulates state that lives in native views, like `TextInput` text and scroll position
31+
- [Event dispatch](contributing/event-dispatch.md): how `fireEvent` and `userEvent` find handlers and which events they send
32+
- [Accessibility model](contributing/accessibility.md): hidden elements, roles, accessible names, and state used by queries and matchers
33+
- [Async, `act`, and timers](contributing/async-and-timers.md): `act` environment, fake timer detection, `waitFor`, `userEvent` delays, and cleanup
34+
- [Example app regeneration](contributing/example-apps.md): upgrading the Expo apps in `examples/`
35+
- [Git, releases, and PR workflow](contributing/git-workflow.md): commit message convention, pull requests, releases
5736

5837
## Reporting issues
5938

‎agents/architecture.md‎

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎agents/build-and-validation.md‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎agents/code-style.md‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

‎agents/example-apps.md‎

Lines changed: 0 additions & 61 deletions
This file was deleted.

‎agents/git-workflow.md‎

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)