From 5bd27bac7fedc9e0b1bd0ba4b083dc7e2025e7a0 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Fri, 10 Feb 2023 00:15:26 +0800 Subject: [PATCH] Enable react-hooks/exhaustive-deps eslint rules (#24914) * Upgrade eslint and eslint-plugin-react-hooks and enable exhaustive-deps * Add CHANGELOG entry * Update changelog with more detail * Alphabetise hooks * Remove accidental prettier dep change introduced via rebase --------- Co-authored-by: Dave Smith <444434+getdave@users.noreply.github.com> Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Co-authored-by: Marco Ciampini <1083581+ciampo@users.noreply.github.com> --- packages/eslint-plugin/CHANGELOG.md | 6 +++++- packages/eslint-plugin/configs/react.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 2785fd73447571..192a728404ea02 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -8,7 +8,7 @@ ## 13.10.0 (2023-02-01) -- The bundled `eslint-plugin-jsdoc` dependency has been updated from requiring `^37.0.3` to requiring `^39.6.9` +- The bundled `eslint-plugin-jsdoc` dependency has been updated from requiring `^37.0.3` to requiring `^39.6.9` ### Enhancement @@ -171,6 +171,10 @@ - The bundled `eslint-plugin-react` dependency has been updated from requiring `^7.20.0` to requiring `^7.22.0` ([#27965](https://github.com/WordPress/gutenberg/pull/27965)). - The bundled `eslint-plugin-react-hooks` dependency has been updated from requiring `^4.0.4` to requiring `^4.2.0` ([#27965](https://github.com/WordPress/gutenberg/pull/27965)). +### New Features + +- Enable `react-hooks/exhaustive-deps` rules in the react config in "warn" mode ([#24914](https://github.com/WordPress/gutenberg/pull/24914)). + ## 7.4.0 (2020-12-17) ### New Feature diff --git a/packages/eslint-plugin/configs/react.js b/packages/eslint-plugin/configs/react.js index 61cf01f48833b6..a30db8442ecc33 100644 --- a/packages/eslint-plugin/configs/react.js +++ b/packages/eslint-plugin/configs/react.js @@ -34,6 +34,7 @@ module.exports = { 'react/no-children-prop': 'off', 'react/prop-types': 'off', 'react/react-in-jsx-scope': 'off', + 'react-hooks/exhaustive-deps': 'warn', 'react-hooks/rules-of-hooks': 'error', }, };