From acaa56b99451833bf9a9a4bf0fb6e526c6797f56 Mon Sep 17 00:00:00 2001 From: Aaron Pettengill Date: Thu, 26 Sep 2019 16:55:03 -0400 Subject: [PATCH] Document `additionalHooks` option --- packages/eslint-plugin-react-hooks/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/eslint-plugin-react-hooks/README.md b/packages/eslint-plugin-react-hooks/README.md index 2fc149a7e35a9..02daad5ab2bcd 100644 --- a/packages/eslint-plugin-react-hooks/README.md +++ b/packages/eslint-plugin-react-hooks/README.md @@ -34,6 +34,20 @@ Then add it to your ESLint configuration: } ``` +## Configuration + +`exhaustive-deps` can be configured to validate custom hooks via the `additionalHooks` option. +This option accepts a regex to match the names of custom hooks. + +```js +{ + "rules": { + // ... + "react-hooks/exhaustive-deps": ["warn", { "additionalHooks": "(useMyCustomHook|useMyOtherCustomHook)" }] + } +} +``` + ## 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.