You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ha...@apache.org on 2026/08/09 16:45:14 UTC

(superset) 01/01: feat(build): reinstate `no-restricted-imports` lint rule for `lodash`

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

hainenber pushed a commit to branch reinstate-import-lint-rule
in repository https://gitbox.apache.org/repos/asf/superset.git

commit 4862413fa2510dba24bac2ebfd1f00b1a21cda88
Author: hainenber <do...@gmail.com>
AuthorDate: Sun Aug 9 23:44:57 2026 +0700

    feat(build): reinstate `no-restricted-imports` lint rule for `lodash`
---
 superset-frontend/oxlint.json                               | 13 +++++++++++++
 .../superset-ui-core/src/chart/components/StatefulChart.tsx |  2 +-
 superset-frontend/src/components/DynamicPlugins/index.tsx   |  1 +
 .../src/explore/components/controls/ViewQueryModal.tsx      |  2 +-
 superset-frontend/src/utils/softDeleteCopy.ts               |  2 +-
 5 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/superset-frontend/oxlint.json b/superset-frontend/oxlint.json
index 6f168d1f78f..599b5f40045 100644
--- a/superset-frontend/oxlint.json
+++ b/superset-frontend/oxlint.json
@@ -276,6 +276,19 @@
           "test*WithInitialValues"
         ]
       }
+    ],
+
+    // === ESLint rules ===
+    "no-restricted-imports": [
+      "error",
+      {
+        "paths": [
+          {
+            "name": "lodash",
+            "message": "Please use tree-shakeable lodash-es instead"
+          }
+        ]
+      }
     ]
   },
   "overrides": [
diff --git a/superset-frontend/packages/superset-ui-core/src/chart/components/StatefulChart.tsx b/superset-frontend/packages/superset-ui-core/src/chart/components/StatefulChart.tsx
index 593c62ea8f6..e56b7820911 100644
--- a/superset-frontend/packages/superset-ui-core/src/chart/components/StatefulChart.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/chart/components/StatefulChart.tsx
@@ -18,7 +18,7 @@
  */
 
 import { useState, useEffect, useRef, useCallback } from 'react';
-import { isEqual } from 'lodash';
+import { isEqual } from 'lodash-es';
 import { ParentSize } from '@visx/responsive';
 import { t } from '@apache-superset/core/translation';
 import {
diff --git a/superset-frontend/src/components/DynamicPlugins/index.tsx b/superset-frontend/src/components/DynamicPlugins/index.tsx
index 166d19fea3b..6e66ff71bba 100644
--- a/superset-frontend/src/components/DynamicPlugins/index.tsx
+++ b/superset-frontend/src/components/DynamicPlugins/index.tsx
@@ -123,6 +123,7 @@ const pluginApi = makeApi<{}, { result: Plugin[] }>({
 
 const sharedModules = {
   react: () => import('react'),
+  // oxlint-disable-next-line no-restricted-imports
   lodash: () => import('lodash'),
   'react-dom': () => import('react-dom'),
   '@superset-ui/chart-controls': () => import('@superset-ui/chart-controls'),
diff --git a/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx b/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx
index 173e15d2dfb..1f572278d3f 100644
--- a/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx
+++ b/superset-frontend/src/explore/components/controls/ViewQueryModal.tsx
@@ -18,7 +18,7 @@
  */
 import { FC, Fragment, useCallback, useEffect, useState } from 'react';
 
-import { omit } from 'lodash';
+import { omit } from 'lodash-es';
 import { t } from '@apache-superset/core/translation';
 import {
   ensureIsArray,
diff --git a/superset-frontend/src/utils/softDeleteCopy.ts b/superset-frontend/src/utils/softDeleteCopy.ts
index 418ab1b1ea4..4363d8476be 100644
--- a/superset-frontend/src/utils/softDeleteCopy.ts
+++ b/superset-frontend/src/utils/softDeleteCopy.ts
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { escape } from 'lodash';
+import { escape } from 'lodash-es';
 import { t } from '@apache-superset/core/translation';
 import { isFeatureEnabled, FeatureFlag } from '@superset-ui/core';
 import getBootstrapData from 'src/utils/getBootstrapData';