diff --git a/packages/eslint-plugin-react-hooks/README.md b/packages/eslint-plugin-react-hooks/README.md index bda6fe8fdc83a..d3e9265894d2f 100644 --- a/packages/eslint-plugin-react-hooks/README.md +++ b/packages/eslint-plugin-react-hooks/README.md @@ -34,6 +34,17 @@ Then add it to your ESLint configuration: } ``` +You can achieve the configuratin above by simply extending the recommended configuration: + +```js +{ + "extends": [ + // ... + "plugin:react-hooks/recommended" + ] +} +``` + ## 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. diff --git a/packages/eslint-plugin-react-hooks/src/index.js b/packages/eslint-plugin-react-hooks/src/index.js index 606a6dff4e253..ff2f396923311 100644 --- a/packages/eslint-plugin-react-hooks/src/index.js +++ b/packages/eslint-plugin-react-hooks/src/index.js @@ -14,3 +14,15 @@ export const rules = { 'rules-of-hooks': RuleOfHooks, 'exhaustive-deps': ExhaustiveDeps, }; + +export const configs = { + recommended: { + plugins: [ + 'react-hooks', + ], + rules: { + 'react-hooks/rules-of-hooks': 'error', + 'react-hooks/exhaustive-deps': 'warn', + }, + }, +};