@samitouri / QOS-React-2 / commits / 79a25125b1

feat: add recommended config eslint rule (#14762)

* feat: add recommended config eslint rule * add exhaustive-deps to recommended as well

Simen Bekkhus committed Feb 28, 2020 at 03:01 UTC 79a25125b19c2d6deaf03d4ab0dfdd6082377d97
2 files changed +21
packages/eslint-plugin-react-hooks/README.md
+11
@@ -34,6 +34,17 @@ Then add it to your ESLint configuration:
34 }
35 ```
36
37 +Or use the recommended config:
38 +
39 +```js
40 +{
41 + "extends": [
42 + // ...
43 + "plugin:react-hooks/recommended"
44 + ]
45 +}
46 +```
47 +
48 ## Valid and Invalid Examples
49
50 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.
packages/eslint-plugin-react-hooks/src/index.js
+10
@@ -10,6 +10,16 @@
10 import RuleOfHooks from './RulesOfHooks';
11 import ExhaustiveDeps from './ExhaustiveDeps';
12
13 +export const configs = {
14 + recommended: {
15 + plugins: ['react-hooks'],
16 + rules: {
17 + 'react-hooks/rules-of-hooks': 'error',
18 + 'react-hooks/exhaustive-deps': 'warn',
19 + },
20 + },
21 +};
22 +
23 export const rules = {
24 'rules-of-hooks': RuleOfHooks,
25 'exhaustive-deps': ExhaustiveDeps,