ViewComponent is intended to be a safe, welcoming space for collaboration. By participating you agree to abide by the Contributor Code of Conduct.
Hi there! We’re thrilled that you’d like to contribute to ViewComponent. Your help is essential for keeping it great.
If you have any substantial changes that you would like to make, please open an issue first to discuss them with us.
Maintainers tend to focus on areas of the project that are useful to them and their employers, but we’re happy to pair with members of the community to enable work on other parts.
Contributions to this project are released to the public under the MIT license.
When opening an issue to describe a bug, it’s helpful to provide steps to reproduce it, either with failing tests in a pull request, or by sharing a repository that demonstrates the issue.
Creating a Rails application to demonstrate a ViewComponent bug
rails new --minimal view_component-bug-replicain the console.
bundle add view_componentin the console. If testing against a previous version of ViewComponent, update the
Gemfileto that version and run
rails generate controller Home index.
root to: 'home#index'.
- Add as little code as possible that’s necessary to reproduce the issue. If possible, use the original code that caused the issue in the application.
- Publish the repository and add a link to the bug report issue.
This repository includes configuration for GitHub Codespaces, making it easy to set up a cloud-based development environment. Follow GitHub’s guide to get started.
The codespace environment includes a minimal Rails app with ViewComponent installed in the
replicate-bug directory. To run the application:
- Start the Rails server from the codespace’s terminal with
- Expose the port when prompted by the Visual Studio Code Web Editor.
- Add the external URL to the config block in
config/application.rbas prompted by the error.
Submitting a pull request
- Fork and clone the repository.
- Configure and install the dependencies:
bundle exec appraisal install.
- Make sure the tests pass:
bundle exec appraisal rake(see below for specific cases).
- Create a new branch:
git checkout -b my-branch-name.
- Add tests, make the change, and make sure the tests still pass.
- Add an entry to the top of
docs/CHANGELOG.mdfor the changes, no matter how small.
- If it’s your first time contributing, add yourself to
- Push to the fork and submit a pull request.
- Wait for the pull request to be reviewed and merged.
Running a subset of tests
bundle exec m test/view_component/YOUR_COMPONENT_test.rb:line_number
Running tests for a specific version of Rails
Specify one of the supported versions listed in Appraisals:
bundle exec appraisal rails-5.2 rake
Previewing changes locally
- Navigate to
- Configure and install the dependencies:
- Run Jekyll:
bundle exec jekyll serve.
- Open the docs site at
- Keep it short.
- Avoid unclear antecedents. Use
the method name is too longinstead of
it's too long.
- Write in the active voice, avoiding the passive voice.
- Refer to methods as
- Use the simplest examples possible.
Don’t be afraid to ask for help! We recognize that English isn’t the first language of many folks who contribute to ViewComponent.
To run the Vale prose linter locally,
brew install vale and
ViewComponent is built by over a hundred members of the community. Project membership has several levels:
ViewComponent triagers are able to manage issues and pull request by assigning owners and labels, closing issues and marking duplicates.
After helping with the project by participating in issues, pull requests, and/or discussions, members of the community are welcome to request triage access by opening a pull request to update this list:
The triagers team is @reeganviljoen.
ViewComponent committers have
write access, enabling them to push directly to the repository and merge pull requests, thus removing the need to contribute via a fork. Committers often have implicit (or even explicit, via CODEOWNERS) ownership over a particular area of the project, such as previews, generators, or translations.
Triagers are welcome to request commit access by opening a pull request to update this list:
The committers team is @elia, @jonspalmer, @juanmanuelramallo, @rmacklin, and @dylanatsmith.
ViewComponent maintainers have
admin access, enabling them to manage repository settings including access levels. They also have ownership of
view_component on RubyGems. Maintainers are required to have 2FA enabled for their GitHub and RubyGems accounts.
Committers are welcome to request maintainership access by opening a pull request to update this list:
The maintainers team is @boardfish, @spone, @camertron, @blakewilliams, and @joelhawksley.