react-use
react-use copied to clipboard
Add markdown lint rules and execute them on pre-commit.
Description
I've noticed that many of the react-use PRs are fixing incorrect javascript syntax errors or typos in the documents.
This PR does the following
Add a markdown lint rule to try to reduce the chance of document errors
- b029301e043c634e5760e9fd0cd579a6753a0a28
- 66214ef0adbecf3149229482c3a06f7622b13b0b
react-use is the most popular hook library for react. I think all hook usage should try to write code that follows the react-hooks lint. But I'm not familiar with some hooks, so I didn't dare to change them randomly, so I turned off the relevant rules first.
Decoupling prettier and eslint. Improve developer experience
- f245860f6e74e3cd0aebc58a2f3b7f032b9b184e
Here is a note from prettier on eslint-plugin-prettier:
These plugins were especially useful when Prettier was new. By running Prettier inside your linters, you didn’t have to set up any new infrastructure and you could re-use your editor integrations for the linters. But these days you can run prettier --check . and most editors have Prettier support.
The downsides of those plugins are:
- You end up with a lot of red squiggly lines in your editor, which gets annoying. Prettier is supposed to make you forget about formatting – and not be in your face about it!
- They are slower than running Prettier directly.
- They’re yet one layer of indirection where things may break.
https://prettier.io/docs/en/integrating-with-linters.html#notes
fixed most usage errors
- fef5bb27e6f0190739120d431af74166564a1036
- ff5f156e4c34aae0c92120936d3660056404da58
- 2866463b989c8c49d3895187d41ad7b3be8dd17f
- ddb143a2f923111e220438484c280f3725fbf0be
- 21e5f8efbc03a986584d723b252ffdb168d553c8
Unify the coding style
- 1eaf16ddaf658bfb2b6efdb36dc752e8c333e7ab
- 3434902aa02801f63f350cb7fc7ff0e5694e12fd
- c37624037bed05e635e65fb6561f847ceb314365
Type of change
- [ ] 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
- [x] Read the Contributing Guide
- [x] Perform a code self-review
- [x] Comment the code, particularly in hard-to-understand areas
- [ ] Add documentation
- [ ] Add hook's story at Storybook
- [ ] Cover changes with tests
- [x] Ensure the test suite passes (
yarn test
) - [ ] Provide 100% tests coverage
- [x] Make sure code lints (
yarn lint
). Fix it withyarn lint:fix
in case of failure. - [x] Make sure types are fine (
yarn lint:types
).