mirror of
https://github.com/facebook/react.git
synced 2026-02-26 18:58:05 +00:00
[eslint-plugin-react-hooks] Prefer recommended eslint configuration (#18951)
* [eslint-plugin-react-hooks] Prefer recommended eslint configuration * Update README.md Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
@@ -18,7 +18,20 @@ npm install eslint-plugin-react-hooks --save-dev
|
||||
yarn add eslint-plugin-react-hooks --dev
|
||||
```
|
||||
|
||||
Then add it to your ESLint configuration:
|
||||
Then extend the recommended eslint config:
|
||||
|
||||
```js
|
||||
{
|
||||
"extends": [
|
||||
// ...
|
||||
"plugin:react-hooks/recommended"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Configuration
|
||||
|
||||
If you want more fine-grained configuration, you can instead add a snippet like this to your ESLint configuration file:
|
||||
|
||||
```js
|
||||
{
|
||||
@@ -34,16 +47,6 @@ Then add it to your ESLint configuration:
|
||||
}
|
||||
```
|
||||
|
||||
Or use the recommended config:
|
||||
|
||||
```js
|
||||
{
|
||||
"extends": [
|
||||
// ...
|
||||
"plugin:react-hooks/recommended"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Valid and Invalid Examples
|
||||
|
||||
|
||||
Reference in New Issue
Block a user