You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ms...@apache.org on 2025/09/20 16:20:55 UTC

(superset) 01/01: perf(effect): add eslint plugin to catch unnecessary useEffects

This is an automated email from the ASF dual-hosted git repository.

msyavuz pushed a commit to branch msyavuz/chore/add-effect-plugin
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 840a7d3cda7eeeb462725e54cff982e2217f54f5
Author: Mehmet Salih Yavuz <sa...@proton.me>
AuthorDate: Sat Sep 20 19:19:55 2025 +0300

    perf(effect): add eslint plugin to catch unnecessary useEffects
---
 superset-frontend/.eslintrc.js      |  1 +
 superset-frontend/package-lock.json | 50 +++++++++++++++++++++++++++++++++++++
 superset-frontend/package.json      |  1 +
 3 files changed, 52 insertions(+)

diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js
index 58440989bd..fdee143bf0 100644
--- a/superset-frontend/.eslintrc.js
+++ b/superset-frontend/.eslintrc.js
@@ -83,6 +83,7 @@ module.exports = {
     'plugin:react-hooks/recommended',
     'plugin:react-prefer-function-component/recommended',
     'plugin:storybook/recommended',
+    'plugin:react-you-might-not-need-an-effect/legacy-recommended',
   ],
   parser: '@babel/eslint-parser',
   parserOptions: {
diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json
index f40a8105f0..d73b70dac1 100644
--- a/superset-frontend/package-lock.json
+++ b/superset-frontend/package-lock.json
@@ -232,6 +232,7 @@
         "eslint-plugin-react": "^7.37.2",
         "eslint-plugin-react-hooks": "^4.6.2",
         "eslint-plugin-react-prefer-function-component": "^3.3.0",
+        "eslint-plugin-react-you-might-not-need-an-effect": "^0.5.0",
         "eslint-plugin-storybook": "^0.8.0",
         "eslint-plugin-testing-library": "^6.4.0",
         "eslint-plugin-theme-colors": "file:eslint-rules/eslint-plugin-theme-colors",
@@ -25929,6 +25930,36 @@
       "dev": true,
       "license": "MIT"
     },
+    "node_modules/eslint-plugin-react-you-might-not-need-an-effect": {
+      "version": "0.5.0",
+      "resolved": "https://registry.npmjs.org/eslint-plugin-react-you-might-not-need-an-effect/-/eslint-plugin-react-you-might-not-need-an-effect-0.5.0.tgz",
+      "integrity": "sha512-n3tY9eAhZ1Exf7dI39Cbsl6PsI/c/PZwKmwZ1OePChiqg2HxoTx7viGrSZfWv7Qk0J4ZGUcC/PYAYh/CDqCnkA==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "eslint-utils": "^3.0.0",
+        "globals": "^16.2.0"
+      },
+      "engines": {
+        "node": ">=14.0.0"
+      },
+      "peerDependencies": {
+        "eslint": ">=8.40.0"
+      }
+    },
+    "node_modules/eslint-plugin-react-you-might-not-need-an-effect/node_modules/globals": {
+      "version": "16.4.0",
+      "resolved": "https://registry.npmjs.org/globals/-/globals-16.4.0.tgz",
+      "integrity": "sha512-ob/2LcVVaVGCYN+r14cnwnoDPUufjiYgSqRhiFD0Q1iI4Odora5RE8Iv1D24hAz5oMophRGkGz+yuvQmmUMnMw==",
+      "dev": true,
+      "license": "MIT",
+      "engines": {
+        "node": ">=18"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/sindresorhus"
+      }
+    },
     "node_modules/eslint-plugin-react/node_modules/doctrine": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
@@ -26044,6 +26075,25 @@
         "node": ">=4.0"
       }
     },
+    "node_modules/eslint-utils": {
+      "version": "3.0.0",
+      "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz",
+      "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==",
+      "dev": true,
+      "license": "MIT",
+      "dependencies": {
+        "eslint-visitor-keys": "^2.0.0"
+      },
+      "engines": {
+        "node": "^10.0.0 || ^12.0.0 || >= 14.0.0"
+      },
+      "funding": {
+        "url": "https://github.com/sponsors/mysticatea"
+      },
+      "peerDependencies": {
+        "eslint": ">=5"
+      }
+    },
     "node_modules/eslint-visitor-keys": {
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz",
diff --git a/superset-frontend/package.json b/superset-frontend/package.json
index 7915b82d19..575665be8e 100644
--- a/superset-frontend/package.json
+++ b/superset-frontend/package.json
@@ -305,6 +305,7 @@
     "eslint-plugin-react": "^7.37.2",
     "eslint-plugin-react-hooks": "^4.6.2",
     "eslint-plugin-react-prefer-function-component": "^3.3.0",
+    "eslint-plugin-react-you-might-not-need-an-effect": "^0.5.0",
     "eslint-plugin-storybook": "^0.8.0",
     "eslint-plugin-testing-library": "^6.4.0",
     "eslint-plugin-theme-colors": "file:eslint-rules/eslint-plugin-theme-colors",