From 7f330e4aa5603cd6c61dcc7956b8baeabb3f374f Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Wed, 12 Nov 2025 11:35:49 -1000 Subject: [PATCH 1/2] Document RBS type signature support in README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add comprehensive documentation about RBS type signatures to help developers leverage type checking in their IDEs. Key additions: - Benefits section explaining type safety advantages - IDE support information (Steep, Solargraph, RubyMine, VS Code) - Usage instructions for validation and listing type files - Location and compatibility information - Links to RBS documentation and sig/README.md Fixes #1953 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/README.md b/README.md index 61e3786374..1e19581a29 100644 --- a/README.md +++ b/README.md @@ -148,6 +148,61 @@ _Requires creating a free account._ - Node.js >= 20 (CI tested: 20 - 22) - A JavaScript package manager (npm, yarn, pnpm, or bun) +# 🔍 Type Safety (RBS) + +React on Rails includes [RBS](https://github.com/ruby/rbs) type signatures for improved type safety and IDE support. + +## Benefits + +- Better autocomplete in supported IDEs +- Early detection of type errors +- Improved code documentation through types +- Enhanced refactoring safety + +## IDE Support + +RBS signatures work with: + +- [Steep](https://github.com/soutaro/steep) - Static type checker for Ruby +- [Solargraph](https://solargraph.org/) - Ruby language server with RBS support +- RubyMine - Built-in RBS support +- VS Code - Via Ruby LSP extensions + +## Usage + +### Validation + +To validate type signatures: + +```bash +bundle exec rake rbs:validate +``` + +Or directly using the RBS CLI: + +```bash +bundle exec rbs -I sig validate +``` + +### Listing Type Files + +To see all available RBS type signature files: + +```bash +bundle exec rake rbs:list +``` + +## Location + +Type signatures are located in the `sig/` directory, organized to mirror the `lib/` directory structure. For more details, see [sig/README.md](sig/README.md). + +## Compatibility + +- Ruby >= 3.0 (RBS is included in Ruby 3.0+) +- RBS gem >= 2.0 + +For more information about RBS, visit the [official RBS documentation](https://github.com/ruby/rbs). + # 🆘 Get Help & Support **Need immediate help?** Here are your options, ordered by response time: From 02a9b25bf97215816078a16794f02f2538138bed Mon Sep 17 00:00:00 2001 From: Justin Gordon Date: Wed, 12 Nov 2025 15:32:56 -1000 Subject: [PATCH 2/2] Move RBS documentation to contributor docs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on PR feedback, move detailed RBS documentation from main README to contributor-specific documentation where it's more appropriate. Changes: - Removed RBS section from README.md - Created docs/contributor-info/rbs-type-signatures.md with comprehensive documentation - Added link to RBS docs in CONTRIBUTING.md - Documentation includes benefits, IDE support, usage, location info, and contributing guidelines The RBS documentation is now properly positioned as contributor documentation rather than top-level user documentation. Fixes #1953 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- CONTRIBUTING.md | 1 + README.md | 55 ------------- docs/contributor-info/rbs-type-signatures.md | 83 ++++++++++++++++++++ 3 files changed, 84 insertions(+), 55 deletions(-) create mode 100644 docs/contributor-info/rbs-type-signatures.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9d7700c3ee..7b0ccedaf7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,7 @@ During this transition: - [docs/contributor-info/Releasing](./docs/contributor-info/releasing.md) for instructions on releasing. - [docs/contributor-info/pull-requests](./docs/contributor-info/pull-requests.md) +- [docs/contributor-info/rbs-type-signatures](./docs/contributor-info/rbs-type-signatures.md) for information on RBS type signatures - See other docs in [docs/contributor-info](./docs/contributor-info) ## Prerequisites diff --git a/README.md b/README.md index 1e19581a29..61e3786374 100644 --- a/README.md +++ b/README.md @@ -148,61 +148,6 @@ _Requires creating a free account._ - Node.js >= 20 (CI tested: 20 - 22) - A JavaScript package manager (npm, yarn, pnpm, or bun) -# 🔍 Type Safety (RBS) - -React on Rails includes [RBS](https://github.com/ruby/rbs) type signatures for improved type safety and IDE support. - -## Benefits - -- Better autocomplete in supported IDEs -- Early detection of type errors -- Improved code documentation through types -- Enhanced refactoring safety - -## IDE Support - -RBS signatures work with: - -- [Steep](https://github.com/soutaro/steep) - Static type checker for Ruby -- [Solargraph](https://solargraph.org/) - Ruby language server with RBS support -- RubyMine - Built-in RBS support -- VS Code - Via Ruby LSP extensions - -## Usage - -### Validation - -To validate type signatures: - -```bash -bundle exec rake rbs:validate -``` - -Or directly using the RBS CLI: - -```bash -bundle exec rbs -I sig validate -``` - -### Listing Type Files - -To see all available RBS type signature files: - -```bash -bundle exec rake rbs:list -``` - -## Location - -Type signatures are located in the `sig/` directory, organized to mirror the `lib/` directory structure. For more details, see [sig/README.md](sig/README.md). - -## Compatibility - -- Ruby >= 3.0 (RBS is included in Ruby 3.0+) -- RBS gem >= 2.0 - -For more information about RBS, visit the [official RBS documentation](https://github.com/ruby/rbs). - # 🆘 Get Help & Support **Need immediate help?** Here are your options, ordered by response time: diff --git a/docs/contributor-info/rbs-type-signatures.md b/docs/contributor-info/rbs-type-signatures.md new file mode 100644 index 0000000000..972d92ff21 --- /dev/null +++ b/docs/contributor-info/rbs-type-signatures.md @@ -0,0 +1,83 @@ +# RBS Type Signatures + +React on Rails includes [RBS](https://github.com/ruby/rbs) type signatures for improved type safety and IDE support. + +## Benefits + +- **Better autocomplete** in supported IDEs +- **Early detection of type errors** during development +- **Improved code documentation** through types +- **Enhanced refactoring safety** with type-aware tools + +## IDE Support + +RBS signatures work with: + +- [Steep](https://github.com/soutaro/steep) - Static type checker for Ruby +- [Solargraph](https://solargraph.org/) - Ruby language server with RBS support +- RubyMine - Built-in RBS support +- VS Code - Via Ruby LSP extensions + +## Usage + +### Validation + +To validate type signatures: + +```bash +bundle exec rake rbs:validate +``` + +Or directly using the RBS CLI: + +```bash +bundle exec rbs -I sig validate +``` + +### Listing Type Files + +To see all available RBS type signature files: + +```bash +bundle exec rake rbs:list +``` + +## Location + +Type signatures are located in the `sig/` directory, organized to mirror the `lib/` directory structure: + +``` +sig/ +├── react_on_rails.rbs # Main module and core classes +├── react_on_rails/ +│ ├── configuration.rbs # Configuration class types +│ ├── helper.rbs # View helper method signatures +│ ├── server_rendering_pool.rbs # Server rendering types +│ ├── utils.rbs # Utility method signatures +│ └── ... # And more +``` + +For more details, see [sig/README.md](../../sig/README.md). + +## Contributing + +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. + +### Adding New Signatures + +1. Create or update the appropriate `.rbs` file in the `sig/` directory +2. Follow the existing structure and naming conventions +3. Run `bundle exec rake rbs:validate` to verify your changes +4. Include the RBS updates in your pull request + +## Compatibility + +- Ruby >= 3.0 (RBS is included in Ruby 3.0+) +- RBS gem >= 2.0 + +## Resources + +- [RBS Documentation](https://github.com/ruby/rbs) +- [RBS Syntax Guide](https://github.com/ruby/rbs/blob/master/docs/syntax.md) +- [Steep Type Checker](https://github.com/soutaro/steep) +- [Solargraph Language Server](https://solargraph.org/)