Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/use-queue
- Loading branch information
Showing
95 changed files
with
5,577 additions
and
3,485 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Description | ||
|
||
<!-- Please include a summary of the change along with relevant motivation and context. --> | ||
|
||
|
||
## Type of change | ||
|
||
<!-- Check all relevant options. --> | ||
- [ ] Bug fix _(non-breaking change which fixes an issue)_ | ||
- [ ] New feature _(non-breaking change which adds functionality)_ | ||
- [ ] **Breaking change** _(fix or feature that would cause existing functionality to not work as before)_ | ||
|
||
# Checklist | ||
- [ ] Read the [Contributing Guide](https://github.com/streamich/react-use/blob/master/CONTRIBUTING.md) | ||
- [ ] Perform a code self-review | ||
- [ ] Comment the code, particularly in hard-to-understand areas | ||
- [ ] Add documentation | ||
- [ ] Add hook's story at Storybook | ||
- [ ] Cover changes with tests | ||
- [ ] Ensure the test suite passes (`yarn test`) | ||
- [ ] Provide 100% tests coverage | ||
- [ ] Make sure code lints (`yarn lint`). Fix it with `yarn lint:fix` in case of failure. | ||
- [ ] Make sure types are fine (`yarn lint:types`). | ||
|
||
<!-- If you can't check all the checkboxes right now - check what you can, create a Draft PR, make some changes if needed and get back to it when you will be able to put some marks in list. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# Contributing | ||
|
||
Thanks for being willing to contribute 🙌 If you contribute to this project, you agree to release your work under the license of this project. | ||
|
||
**Working on your first Pull Request?** You can learn how from this [First Contributions](https://github.com/firstcontributions/first-contributions) guide. | ||
|
||
## Project setup | ||
|
||
1. Fork and clone the repo | ||
1. Run `yarn install` to install dependencies | ||
1. Create a branch for your PR with `git checkout -b pr/your-branch-name` | ||
|
||
> Tip: Keep your `master` branch pointing at the original repository and make | ||
> pull requests from branches on your fork. To do this, run: | ||
> | ||
> ```sh | ||
> git remote add upstream https://github.com/streamich/react-use.git | ||
> git fetch upstream | ||
> git branch --set-upstream-to=upstream/master master | ||
> ``` | ||
> | ||
> This will add the original repository as a "remote" called "upstream," Then | ||
> fetch the git information from that remote, then set your local `master` | ||
> branch to use the upstream master branch whenever you run `git pull`. Then you | ||
> can make all of your pull request branches based on this `master` branch. | ||
> Whenever you want to update your version of `master`, do a regular `git pull`. | ||
## Development | ||
|
||
This library is a collection of React hooks so a proposal for a new hook will need to utilize the [React Hooks API](https://reactjs.org/docs/hooks-reference.html) internally to be taken into consideration. | ||
|
||
### Creating a new hook | ||
|
||
1. Create `src/useYourHookName.ts` and `src/__stories__/useYourHookName.story.tsx`, run `yarn start` to start the storybook development server and start coding your hook | ||
1. Create `src/__tests__/useYourHookName.test.ts`, run `yarn test:watch` to start the test runner in watch mode and start writing tests for your hook | ||
1. Create `src/docs/useYourHookName.md` and create documentation for your hook | ||
1. Export your hook from `src/index.ts` and add your hook to `README.md` | ||
|
||
You can also write your tests first if you prefer [test-driven development](https://en.wikipedia.org/wiki/Test-driven_development). | ||
|
||
### Updating an existing hook | ||
|
||
1. Run `yarn start` to start the storybook development server and start applying changes | ||
2. Update tests according to your changes using `yarn test:watch` | ||
3. Update documentation according to your changes | ||
|
||
## Committing and Pushing changes | ||
|
||
### Commit messages | ||
|
||
This repo uses [semantic-release](https://github.com/semantic-release/semantic-release) and [conventional commit messages](https://conventionalcommits.org) so prefix your commits with `fix:` or `feat:` if you want your changes to appear in [release notes](https://github.com/streamich/react-use/blob/master/CHANGELOG.md). | ||
|
||
### Git hooks | ||
|
||
There are git hooks set up with this project that are automatically enabled | ||
when you install dependencies. These hooks automatically test and validate your code when creating commits. They're really handy but can be temporarily disabled by adding a `--no-verify` flag to your commit command. This is useful when you want to commit and push to get feedback on uncompleted code. | ||
|
||
## Help needed | ||
|
||
Please have a look at the [open issues](https://github.com/streamich/react-use/issues) and respond to questions, bug reports and feature requests. Thanks! | ||
|
||
We're also looking to improve the code coverage on this project. To easily know what hooks need tests run `yarn test:coverage` to generate a code coverage report. You can see the report in your terminal or open `coverage/lcov-report/index.html` to see the HTML report. |
Oops, something went wrong.