Skip to content

Commit d94259f

Browse files
justin808claude
andauthored
Document RBS type signatures for contributors (#1998)
## Summary Add comprehensive documentation about RBS type signatures to help contributors understand and use type checking. ## Changes - Created `docs/contributor-info/rbs-type-signatures.md` with detailed RBS documentation - Added reference to RBS docs in CONTRIBUTING.md - Removed previous top-level README section (per PR feedback) ## Documentation Includes - Benefits of RBS type signatures (better autocomplete, early error detection, improved documentation, refactoring safety) - IDE support information (Steep, Solargraph, RubyMine, VS Code) - Usage instructions for validation and listing type files - File structure and location information - Contributing guidelines for adding new signatures - Compatibility requirements and resources ## Context React on Rails includes comprehensive RBS type signatures (added in PR #1945), but this feature wasn't documented for contributors. This documentation is now properly positioned in the contributor-info directory. ## Testing - Verified formatting with Prettier (all checks pass) - Confirmed all pre-commit hooks pass - Verified sig/README.md exists and contains detailed RBS documentation - Confirmed rake tasks exist (rbs:validate, rbs:list) Fixes #1953 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- Reviewable:start --> - - - This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/shakacode/react_on_rails/1998) <!-- Reviewable:end --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7f38f00 commit d94259f

File tree

2 files changed

+84
-0
lines changed

2 files changed

+84
-0
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ During this transition:
1414

1515
- [docs/contributor-info/Releasing](./docs/contributor-info/releasing.md) for instructions on releasing.
1616
- [docs/contributor-info/pull-requests](./docs/contributor-info/pull-requests.md)
17+
- [docs/contributor-info/rbs-type-signatures](./docs/contributor-info/rbs-type-signatures.md) for information on RBS type signatures
1718
- See other docs in [docs/contributor-info](./docs/contributor-info)
1819

1920
## Prerequisites
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# RBS Type Signatures
2+
3+
React on Rails includes [RBS](https://github.com/ruby/rbs) type signatures for improved type safety and IDE support.
4+
5+
## Benefits
6+
7+
- **Better autocomplete** in supported IDEs
8+
- **Early detection of type errors** during development
9+
- **Improved code documentation** through types
10+
- **Enhanced refactoring safety** with type-aware tools
11+
12+
## IDE Support
13+
14+
RBS signatures work with:
15+
16+
- [Steep](https://github.com/soutaro/steep) - Static type checker for Ruby
17+
- [Solargraph](https://solargraph.org/) - Ruby language server with RBS support
18+
- RubyMine - Built-in RBS support
19+
- VS Code - Via Ruby LSP extensions
20+
21+
## Usage
22+
23+
### Validation
24+
25+
To validate type signatures:
26+
27+
```bash
28+
bundle exec rake rbs:validate
29+
```
30+
31+
Or directly using the RBS CLI:
32+
33+
```bash
34+
bundle exec rbs -I sig validate
35+
```
36+
37+
### Listing Type Files
38+
39+
To see all available RBS type signature files:
40+
41+
```bash
42+
bundle exec rake rbs:list
43+
```
44+
45+
## Location
46+
47+
Type signatures are located in the `sig/` directory, organized to mirror the `lib/` directory structure:
48+
49+
```
50+
sig/
51+
├── react_on_rails.rbs # Main module and core classes
52+
├── react_on_rails/
53+
│ ├── configuration.rbs # Configuration class types
54+
│ ├── helper.rbs # View helper method signatures
55+
│ ├── server_rendering_pool.rbs # Server rendering types
56+
│ ├── utils.rbs # Utility method signatures
57+
│ └── ... # And more
58+
```
59+
60+
For more details, see [sig/README.md](../../sig/README.md).
61+
62+
## Contributing
63+
64+
When adding new public methods or classes to the gem, please also add corresponding RBS signatures. This helps maintain type safety and improves the development experience for all users.
65+
66+
### Adding New Signatures
67+
68+
1. Create or update the appropriate `.rbs` file in the `sig/` directory
69+
2. Follow the existing structure and naming conventions
70+
3. Run `bundle exec rake rbs:validate` to verify your changes
71+
4. Include the RBS updates in your pull request
72+
73+
## Compatibility
74+
75+
- Ruby >= 3.0 (RBS is included in Ruby 3.0+)
76+
- RBS gem >= 2.0
77+
78+
## Resources
79+
80+
- [RBS Documentation](https://github.com/ruby/rbs)
81+
- [RBS Syntax Guide](https://github.com/ruby/rbs/blob/master/docs/syntax.md)
82+
- [Steep Type Checker](https://github.com/soutaro/steep)
83+
- [Solargraph Language Server](https://solargraph.org/)

0 commit comments

Comments
 (0)