From ca445d7b24dfdab43497992308b2d3e48c47958e Mon Sep 17 00:00:00 2001 From: chad1008 <13856531+chad1008@users.noreply.github.com> Date: Thu, 19 May 2022 10:42:40 -0400 Subject: [PATCH 1/6] Components: set eslint `react-hooks/exhaustive-deps` to `warn` --- packages/components/.eslintrc.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 packages/components/.eslintrc.js diff --git a/packages/components/.eslintrc.js b/packages/components/.eslintrc.js new file mode 100644 index 0000000000000..aad284350902b --- /dev/null +++ b/packages/components/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + rules: { + 'react-hooks/exhaustive-deps': 'warn', + }, +}; From 5ab8957940f525481de95df6e557e75d5ef85127 Mon Sep 17 00:00:00 2001 From: chad1008 <13856531+chad1008@users.noreply.github.com> Date: Mon, 23 May 2022 10:02:11 -0400 Subject: [PATCH 2/6] Components: move exhaustive-deps eslint rule to main plugin .eslintrc file --- .eslintrc.js | 7 +++++++ packages/components/.eslintrc.js | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) delete mode 100644 packages/components/.eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js index 38992de398e51..bc3faafc4b048 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -322,6 +322,13 @@ module.exports = { ], }, }, + { + files: [ 'packages/components/src/**/*.js' ], + excludedFiles: [ ...developmentFiles ], + rules: { + 'react-hooks/exhaustive-deps': 'warn', + }, + }, { files: [ 'packages/jest*/**/*.js', '**/test/**/*.js' ], excludedFiles: [ 'test/e2e/**/*.js' ], diff --git a/packages/components/.eslintrc.js b/packages/components/.eslintrc.js deleted file mode 100644 index aad284350902b..0000000000000 --- a/packages/components/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - rules: { - 'react-hooks/exhaustive-deps': 'warn', - }, -}; From d76c02db1d8fc15c25dbcd22ace38bee2fa18ced Mon Sep 17 00:00:00 2001 From: chad1008 <13856531+chad1008@users.noreply.github.com> Date: Mon, 23 May 2022 14:12:01 -0400 Subject: [PATCH 3/6] Update .eslintrc.js Co-authored-by: Marco Ciampini --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index bc3faafc4b048..99329f7dc286f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -323,7 +323,7 @@ module.exports = { }, }, { - files: [ 'packages/components/src/**/*.js' ], + files: [ 'packages/components/src/**/*.[tj]s?(x)' ] excludedFiles: [ ...developmentFiles ], rules: { 'react-hooks/exhaustive-deps': 'warn', From 32f22b304c0f6692dd4415df485661547733b6d7 Mon Sep 17 00:00:00 2001 From: chad1008 <13856531+chad1008@users.noreply.github.com> Date: Mon, 23 May 2022 14:30:14 -0400 Subject: [PATCH 4/6] add missing comma --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 99329f7dc286f..31c87805cb96d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -323,7 +323,7 @@ module.exports = { }, }, { - files: [ 'packages/components/src/**/*.[tj]s?(x)' ] + files: [ 'packages/components/src/**/*.[tj]s?(x)' ], excludedFiles: [ ...developmentFiles ], rules: { 'react-hooks/exhaustive-deps': 'warn', From dfca6bee6163a825c3f88060a4e0b85c7c0fe301 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Thu, 10 Nov 2022 17:16:13 -0700 Subject: [PATCH 5/6] Switch from warn to error --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 31c87805cb96d..22cb9209b2e9e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -326,7 +326,7 @@ module.exports = { files: [ 'packages/components/src/**/*.[tj]s?(x)' ], excludedFiles: [ ...developmentFiles ], rules: { - 'react-hooks/exhaustive-deps': 'warn', + 'react-hooks/exhaustive-deps': 'error', }, }, { From 2a9cff75cece379b37e36e7757e6d5c35910d060 Mon Sep 17 00:00:00 2001 From: chad1008 <13856531+chad1008@users.noreply.github.com> Date: Mon, 14 Nov 2022 10:27:48 -0500 Subject: [PATCH 6/6] update CHANGELOG --- packages/components/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 11bae78e235e2..fe144c59ec1bb 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -28,6 +28,7 @@ - `Draggable`: Convert to TypeScript ([#45471](https://github.com/WordPress/gutenberg/pull/45471)). - `MenuGroup`: Convert to TypeScript ([#45617](https://github.com/WordPress/gutenberg/pull/45617)). - `useCx`: fix story to satisfy the `react-hooks/exhaustive-deps` eslint rule ([#45614](https://github.com/WordPress/gutenberg/pull/45614)) +- Activate the `react-hooks/exhuastive-deps` eslint rule for the Components package ([#41166](https://github.com/WordPress/gutenberg/pull/41166)) ### Experimental