You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by en...@apache.org on 2026/06/04 20:44:28 UTC

(superset) 07/08: fix: lint

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

EnxDev pushed a commit to branch test/chatbot-local
in repository https://gitbox.apache.org/repos/asf/superset.git

commit e2a971ef6932b68603a83a8d16ec742798bd5fce
Author: Enzo Martellucci <en...@gmail.com>
AuthorDate: Thu Jun 4 11:57:27 2026 +0200

    fix: lint
---
 superset-frontend/.eslintrc.js                     |  2 +-
 .../src/components/Select/Select.tsx               |  6 +++--
 .../tests/dashboard/clear-all-filters.spec.ts      |  5 +---
 .../BigNumberWithTrendline/transformProps.test.ts  |  4 +--
 .../plugin-chart-echarts/src/components/Echart.tsx |  7 ++++--
 superset-frontend/src/core/dashboard/index.test.ts |  9 ++++---
 .../controls/CollectionControl/index.tsx           |  4 ++-
 .../src/extensions/ExtensionsList.test.tsx         | 29 ++++++++++++++++------
 .../src/features/roles/RoleListEditModal.test.tsx  | 16 ++++++------
 .../src/middleware/loggerMiddleware.ts             |  7 +++++-
 10 files changed, 56 insertions(+), 33 deletions(-)

diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js
index 002d3f39252..d7b72a6d93e 100644
--- a/superset-frontend/.eslintrc.js
+++ b/superset-frontend/.eslintrc.js
@@ -80,7 +80,7 @@ const restrictedImportsRules = {
   'no-jest-mock-console': {
     name: 'jest-mock-console',
     message: 'Please use native Jest spies, i.e. jest.spyOn(console, "warn")',
-  }
+  },
 };
 
 module.exports = {
diff --git a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
index bab0e9a7394..971bcd45cd8 100644
--- a/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
+++ b/superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
@@ -519,7 +519,8 @@ const Select = forwardRef(
               handleSelectAll();
             }}
           >
-            {t('Select all')} {`(${formatNumber('SMART_NUMBER', bulkSelectCounts.selectable)})`}
+            {t('Select all')}{' '}
+            {`(${formatNumber('SMART_NUMBER', bulkSelectCounts.selectable)})`}
           </Button>
           <Button
             type="link"
@@ -536,7 +537,8 @@ const Select = forwardRef(
               handleDeselectAll();
             }}
           >
-            {t('Clear')} {`(${formatNumber('SMART_NUMBER', bulkSelectCounts.deselectable)})`}
+            {t('Clear')}{' '}
+            {`(${formatNumber('SMART_NUMBER', bulkSelectCounts.deselectable)})`}
           </Button>
         </StyledBulkActionsContainer>
       ),
diff --git a/superset-frontend/playwright/tests/dashboard/clear-all-filters.spec.ts b/superset-frontend/playwright/tests/dashboard/clear-all-filters.spec.ts
index 4cd0c56f4b3..6bb30c3094b 100644
--- a/superset-frontend/playwright/tests/dashboard/clear-all-filters.spec.ts
+++ b/superset-frontend/playwright/tests/dashboard/clear-all-filters.spec.ts
@@ -182,10 +182,7 @@ testWithAssets(
     // Now track POST /api/v1/chart/data requests around Clear All
     const postsAfterClearAll: string[] = [];
     const handler = (req: any) => {
-      if (
-        req.url().includes('/api/v1/chart/data') &&
-        req.method() === 'POST'
-      ) {
+      if (req.url().includes('/api/v1/chart/data') && req.method() === 'POST') {
         postsAfterClearAll.push(req.url());
       }
     };
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts
index 6ce84f5ffe4..6a9752d57b9 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberWithTrendline/transformProps.test.ts
@@ -288,9 +288,7 @@ describe('BigNumberWithTrendline transformProps', () => {
       height: 300,
       queriesData: [
         {
-          data: [
-            { __timestamp: 1, value: 100 },
-          ] as unknown as BigNumberDatum[],
+          data: [{ __timestamp: 1, value: 100 }] as unknown as BigNumberDatum[],
           colnames: ['__timestamp', 'value'],
           coltypes: ['TEMPORAL', 'NUMERIC'],
         },
diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx b/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
index 97b55f2a9a7..618cb62142c 100644
--- a/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
+++ b/superset-frontend/plugins/plugin-chart-echarts/src/components/Echart.tsx
@@ -284,8 +284,11 @@ function Echart(
       // setOption(notMerge:true) replaces the dataZoom config, dropping any
       // range the user has engaged. Preserve it across the call.
       const previousZoom = notMerge
-        ? (chartRef.current?.getOption() as { dataZoom?: DataZoomComponentOption[] })
-            ?.dataZoom
+        ? (
+            chartRef.current?.getOption() as {
+              dataZoom?: DataZoomComponentOption[];
+            }
+          )?.dataZoom
         : undefined;
       chartRef.current?.setOption(themedEchartOptions, {
         notMerge,
diff --git a/superset-frontend/src/core/dashboard/index.test.ts b/superset-frontend/src/core/dashboard/index.test.ts
index f5078c2e7c1..fdec33743ef 100644
--- a/superset-frontend/src/core/dashboard/index.test.ts
+++ b/superset-frontend/src/core/dashboard/index.test.ts
@@ -92,7 +92,6 @@ test('getCurrentDashboard returns undefined when not on dashboard page', () => {
   expect(dashboard.getCurrentDashboard()).toBeUndefined();
 });
 
-
 test('getCurrentDashboard returns undefined when dashboardInfo is absent', () => {
   mockState = makeState({ dashboardInfo: undefined });
   expect(dashboard.getCurrentDashboard()).toBeUndefined();
@@ -122,9 +121,13 @@ test('getCurrentDashboard excludes dataMask entries not in nativeFilters', () =>
 
 test('filter array value is a defensive copy — mutation does not affect Redux state', () => {
   const ctx = dashboard.getCurrentDashboard();
-  const original = [...(mockState as any).dataMask['filter-1'].filterState.value];
+  const original = [
+    ...(mockState as any).dataMask['filter-1'].filterState.value,
+  ];
   (ctx!.filters[0].value as string[]).push('East');
-  expect((mockState as any).dataMask['filter-1'].filterState.value).toEqual(original);
+  expect((mockState as any).dataMask['filter-1'].filterState.value).toEqual(
+    original,
+  );
 });
 
 // Action type strings match the constants in src/dashboard/actions/hydrate
diff --git a/superset-frontend/src/explore/components/controls/CollectionControl/index.tsx b/superset-frontend/src/explore/components/controls/CollectionControl/index.tsx
index 2b0e01b0129..1a0393577ad 100644
--- a/superset-frontend/src/explore/components/controls/CollectionControl/index.tsx
+++ b/superset-frontend/src/explore/components/controls/CollectionControl/index.tsx
@@ -188,7 +188,9 @@ function CollectionControl({
   // Two items can collide when keyAccessor returns falsy and the index
   // fallback is used — breaking dnd-kit reordering and React reconciliation.
   // Assign a stable nanoid per item ref when no key is available.
-  const generatedIdsRef = useRef<WeakMap<CollectionItem, string>>(new WeakMap());
+  const generatedIdsRef = useRef<WeakMap<CollectionItem, string>>(
+    new WeakMap(),
+  );
   const itemIds = useMemo(
     () =>
       value.map(item => {
diff --git a/superset-frontend/src/extensions/ExtensionsList.test.tsx b/superset-frontend/src/extensions/ExtensionsList.test.tsx
index c48bfc174f0..53c8248c90b 100644
--- a/superset-frontend/src/extensions/ExtensionsList.test.tsx
+++ b/superset-frontend/src/extensions/ExtensionsList.test.tsx
@@ -17,7 +17,13 @@
  * under the License.
  */
 import userEvent from '@testing-library/user-event';
-import { fireEvent, render, screen, waitFor, within } from 'spec/helpers/testing-library';
+import {
+  fireEvent,
+  render,
+  screen,
+  waitFor,
+  within,
+} from 'spec/helpers/testing-library';
 import { SupersetClient } from '@superset-ui/core';
 import ExtensionsList from './ExtensionsList';
 
@@ -36,7 +42,9 @@ jest.mock('src/components', () => ({
         {(data ?? []).map((row: any) =>
           columns.map((col: any) => (
             <td key={`${row.id}-${col.id}`}>
-              {col.Cell ? col.Cell({ row: { original: row } }) : row[col.accessor]}
+              {col.Cell
+                ? col.Cell({ row: { original: row } })
+                : row[col.accessor]}
             </td>
           )),
         )}
@@ -195,7 +203,9 @@ test('clicking delete opens confirmation dialog', async () => {
   await userEvent.click(screen.getByTestId('delete-extension'));
 
   await waitFor(() => {
-    expect(screen.getByText(/are you sure you want to delete/i)).toBeInTheDocument();
+    expect(
+      screen.getByText(/are you sure you want to delete/i),
+    ).toBeInTheDocument();
   });
 });
 
@@ -263,7 +273,9 @@ test('pressing Enter on star span triggers set-default action', async () => {
   renderList();
   await waitFor(() => screen.getByText('chatbot'));
 
-  fireEvent.keyDown(screen.getByTestId('set-default-chatbot'), { key: 'Enter' });
+  fireEvent.keyDown(screen.getByTestId('set-default-chatbot'), {
+    key: 'Enter',
+  });
 
   await waitFor(() => {
     expect(mockPut).toHaveBeenCalled();
@@ -277,9 +289,7 @@ test('uploading a non-.supx file shows danger toast without calling API', async
   const input = document.querySelector<HTMLInputElement>('input[type="file"]')!;
   uploadFile(input, new File(['x'], 'evil.zip', { type: 'application/zip' }));
 
-  expect(addDangerToast).toHaveBeenCalledWith(
-    expect.stringMatching(/\.supx/i),
-  );
+  expect(addDangerToast).toHaveBeenCalledWith(expect.stringMatching(/\.supx/i));
   expect(mockPost).not.toHaveBeenCalled();
 });
 
@@ -288,7 +298,10 @@ test('uploading a .supx file calls POST endpoint and refreshes list', async () =
   renderList();
 
   const input = document.querySelector<HTMLInputElement>('input[type="file"]')!;
-  uploadFile(input, new File(['PK'], 'my.supx', { type: 'application/octet-stream' }));
+  uploadFile(
+    input,
+    new File(['PK'], 'my.supx', { type: 'application/octet-stream' }),
+  );
 
   await waitFor(() => {
     expect(mockPost).toHaveBeenCalledWith(
diff --git a/superset-frontend/src/features/roles/RoleListEditModal.test.tsx b/superset-frontend/src/features/roles/RoleListEditModal.test.tsx
index 9072f991f21..9380d4c04a6 100644
--- a/superset-frontend/src/features/roles/RoleListEditModal.test.tsx
+++ b/superset-frontend/src/features/roles/RoleListEditModal.test.tsx
@@ -252,9 +252,7 @@ describe('RoleListEditModal', () => {
     const mockGet = SupersetClient.get as jest.Mock;
     mockGet.mockImplementation(({ endpoint }) => {
       if (
-        endpoint?.includes(
-          `/api/v1/security/roles/${mockRole.id}/permissions/`,
-        )
+        endpoint?.includes(`/api/v1/security/roles/${mockRole.id}/permissions/`)
       ) {
         // Only return permission id=10, not id=20
         return Promise.resolve({
@@ -298,9 +296,7 @@ describe('RoleListEditModal', () => {
     const mockGet = SupersetClient.get as jest.Mock;
     mockGet.mockImplementation(({ endpoint }) => {
       if (
-        endpoint?.includes(
-          `/api/v1/security/roles/${mockRole.id}/permissions/`,
-        )
+        endpoint?.includes(`/api/v1/security/roles/${mockRole.id}/permissions/`)
       ) {
         return Promise.reject(new Error('network error'));
       }
@@ -371,7 +367,9 @@ describe('RoleListEditModal', () => {
     };
 
     mockGet.mockImplementation(({ endpoint }) => {
-      if (endpoint?.includes(`/api/v1/security/roles/${roleA.id}/permissions/`)) {
+      if (
+        endpoint?.includes(`/api/v1/security/roles/${roleA.id}/permissions/`)
+      ) {
         return Promise.resolve({
           json: {
             result: roleA.permission_ids.map(pid => ({
@@ -382,7 +380,9 @@ describe('RoleListEditModal', () => {
           },
         });
       }
-      if (endpoint?.includes(`/api/v1/security/roles/${roleB.id}/permissions/`)) {
+      if (
+        endpoint?.includes(`/api/v1/security/roles/${roleB.id}/permissions/`)
+      ) {
         return Promise.resolve({
           json: {
             result: roleB.permission_ids.map(pid => ({
diff --git a/superset-frontend/src/middleware/loggerMiddleware.ts b/superset-frontend/src/middleware/loggerMiddleware.ts
index a41d96a53e6..3182bd18771 100644
--- a/superset-frontend/src/middleware/loggerMiddleware.ts
+++ b/superset-frontend/src/middleware/loggerMiddleware.ts
@@ -33,7 +33,12 @@ import { ensureAppRoot } from '../utils/pathUtils';
 import type { DashboardInfo, DashboardLayoutState } from '../dashboard/types';
 import type { QueryEditor } from '../SqlLab/types';
 
-type LogEventSource = 'dashboard' | 'embedded_dashboard' | 'explore' | 'sqlLab' | 'slice';
+type LogEventSource =
+  | 'dashboard'
+  | 'embedded_dashboard'
+  | 'explore'
+  | 'sqlLab'
+  | 'slice';
 
 interface LogEventData {
   source?: LogEventSource;