forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
1,302 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# `eslint-plugin-react-hooks` | ||
|
||
This ESLint plugin enforces the [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html). | ||
|
||
It is a part of the [Hooks proposal](https://reactjs.org/docs/hooks-intro.html) for React. | ||
|
||
## Experimental Status | ||
|
||
This is an experimental release and is intended to be used for testing the Hooks proposal with React 16.7 alpha. The exact heuristics it uses may be adjusted. | ||
|
||
The [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) documentation contains a link to the technical RFC. Please leave a comment on the RFC if you have concerns or ideas about how this plugin should work. | ||
|
||
## Installation | ||
|
||
**Note: If you're using Create React App, please wait for a corresponding experimental release of `react-scripts` that includes this rule instead of adding it directly.** | ||
|
||
Assuming you already have ESLint installed, run: | ||
|
||
```sh | ||
# npm | ||
npm install eslint-plugin-react-hooks@next --save-dev | ||
|
||
# yarn | ||
yarn add eslint-plugin-react-hooks@next --dev | ||
``` | ||
|
||
Then add it to your ESLint configuration: | ||
|
||
```js | ||
{ | ||
"plugins": [ | ||
// ... | ||
"react-hooks" | ||
], | ||
"rules": { | ||
// ... | ||
"react-hooks/rules-of-hooks": "error" | ||
} | ||
} | ||
``` | ||
|
||
## Valid and Invalid Examples | ||
|
||
Please refer to the [Rules of Hooks](https://reactjs.org/docs/hooks-rules.html) documentation and the [Hooks FAQ](https://reactjs.org/docs/hooks-faq.html#what-exactly-do-the-lint-rules-enforce) to learn more about this rule. | ||
|
||
## License | ||
|
||
MIT |
Oops, something went wrong.