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

michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new d6f9fb5af1 chore: Removes unused vars (#20194)
d6f9fb5af1 is described below

commit d6f9fb5af113dce54e73432e4c13eca0bafbee6f
Author: Michael S. Molina <[email protected]>
AuthorDate: Wed Jun 15 11:01:45 2022 -0300

    chore: Removes unused vars (#20194)
    
    * chore: Removes unused vars
    
    * Fixes lint
    
    * Disables no-unused-vars for the operators
---
 .../integration/dashboard/nativeFilters.test.ts    |  7 -----
 .../cypress/integration/dashboard/save.test.js     |  4 +--
 .../src/operators/contributionOperator.ts          |  1 +
 .../src/operators/flattenOperator.ts               |  1 +
 .../src/operators/prophetOperator.ts               |  1 +
 .../src/operators/resampleOperator.ts              |  1 +
 .../src/query/buildQueryContext.ts                 | 36 ++++------------------
 .../components/EstimateQueryCostButton/index.tsx   |  6 ----
 .../src/SqlLab/components/SqlEditor/index.jsx      |  3 --
 .../components/SliceHeaderControls/index.tsx       |  1 -
 .../FiltersConfigModal/FilterTitleContainer.tsx    | 30 ------------------
 .../filters/components/TimeColumn/buildQuery.ts    |  2 +-
 superset-frontend/src/middleware/asyncEvent.ts     |  6 ++--
 superset-frontend/src/utils/downloadAsImage.ts     |  3 +-
 .../data/database/DatabaseModal/SqlAlchemyForm.tsx |  2 --
 .../CRUD/data/database/DatabaseModal/index.tsx     |  1 -
 .../src/views/CRUD/data/query/QueryList.tsx        |  2 +-
 .../views/CRUD/data/savedquery/SavedQueryList.tsx  |  1 -
 18 files changed, 18 insertions(+), 90 deletions(-)

diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
 
b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
index 01dc4b3495..b409aa06d0 100644
--- 
a/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
+++ 
b/superset-frontend/cypress-base/cypress/integration/dashboard/nativeFilters.test.ts
@@ -59,13 +59,6 @@ import {
 import { DASHBOARD_LIST } from '../dashboard_list/dashboard_list.helper';
 import { CHART_LIST } from '../chart_list/chart_list.helper';
 
-const getTestTitle = (
-  test: Mocha.Suite = (Cypress as any).mocha.getRunner().suite.ctx.test,
-): string =>
-  test.parent?.title
-    ? `${getTestTitle(test.parent)} -- ${test.title}`
-    : test.title;
-
 // TODO: fix flaky init logic and re-enable
 const milliseconds = new Date().getTime();
 const dashboard = `Test Dashboard${milliseconds}`;
diff --git 
a/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js 
b/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js
index b0e9d1141c..3c815a222c 100644
--- a/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js
+++ b/superset-frontend/cypress-base/cypress/integration/dashboard/save.test.js
@@ -36,7 +36,7 @@ describe('Dashboard save action', () => {
   beforeEach(() => {
     cy.login();
     cy.visit(WORLD_HEALTH_DASHBOARD);
-    cy.get('#app').then(data => {
+    cy.get('#app').then(() => {
       cy.get('.dashboard-header-container').then(headerContainerElement => {
         const dashboardId = headerContainerElement.attr('data-test-id');
 
@@ -57,7 +57,7 @@ describe('Dashboard save action', () => {
 
   // change to what the title should be
   it('should save as new dashboard', () => {
-    cy.wait('@copyRequest').then(xhr => {
+    cy.wait('@copyRequest').then(() => {
       cy.get('[data-test="editable-title"]').then(element => {
         const dashboardTitle = element.attr('title');
         expect(dashboardTitle).to.not.equal(`World Bank's Data`);
diff --git 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/contributionOperator.ts
 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/contributionOperator.ts
index 484117c44f..39fa9c4433 100644
--- 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/contributionOperator.ts
+++ 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/contributionOperator.ts
@@ -19,6 +19,7 @@
 import { PostProcessingContribution } from '@superset-ui/core';
 import { PostProcessingFactory } from './types';
 
+/* eslint-disable @typescript-eslint/no-unused-vars */
 export const contributionOperator: 
PostProcessingFactory<PostProcessingContribution> =
   (formData, queryObject) => {
     if (formData.contributionMode) {
diff --git 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/flattenOperator.ts
 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/flattenOperator.ts
index 2fe732fc83..d5aa4ab186 100644
--- 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/flattenOperator.ts
+++ 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/flattenOperator.ts
@@ -19,6 +19,7 @@
 import { PostProcessingFlatten } from '@superset-ui/core';
 import { PostProcessingFactory } from './types';
 
+/* eslint-disable @typescript-eslint/no-unused-vars */
 export const flattenOperator: PostProcessingFactory<PostProcessingFlatten> = (
   formData,
   queryObject,
diff --git 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts
 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts
index a55c8d3d9e..ff0fa0fb65 100644
--- 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts
+++ 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/prophetOperator.ts
@@ -23,6 +23,7 @@ import {
 } from '@superset-ui/core';
 import { PostProcessingFactory } from './types';
 
+/* eslint-disable @typescript-eslint/no-unused-vars */
 export const prophetOperator: PostProcessingFactory<PostProcessingProphet> = (
   formData,
   queryObject,
diff --git 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/resampleOperator.ts
 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/resampleOperator.ts
index 2306ea38f9..b157a054d1 100644
--- 
a/superset-frontend/packages/superset-ui-chart-controls/src/operators/resampleOperator.ts
+++ 
b/superset-frontend/packages/superset-ui-chart-controls/src/operators/resampleOperator.ts
@@ -20,6 +20,7 @@
 import { PostProcessingResample } from '@superset-ui/core';
 import { PostProcessingFactory } from './types';
 
+/* eslint-disable @typescript-eslint/no-unused-vars */
 export const resampleOperator: PostProcessingFactory<PostProcessingResample> = 
(
   formData,
   queryObject,
diff --git 
a/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts 
b/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts
index ad35434cad..dbc1289c54 100644
--- a/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts
+++ b/superset-frontend/packages/superset-ui-core/src/query/buildQueryContext.ts
@@ -24,19 +24,7 @@ import { QueryContext, QueryObject } from './types/Query';
 import { SetDataMaskHook } from '../chart';
 import { JsonObject } from '../connection';
 
-const WRAP_IN_ARRAY = (
-  baseQueryObject: QueryObject,
-  options?: {
-    extras?: {
-      cachedChanges?: any;
-    };
-    ownState?: JsonObject;
-    hooks?: {
-      setDataMask: SetDataMaskHook;
-      setCachedChanges: (newChanges: any) => void;
-    };
-  },
-) => [baseQueryObject];
+const WRAP_IN_ARRAY = (baseQueryObject: QueryObject) => [baseQueryObject];
 
 export type BuildFinalQueryObjects = (
   baseQueryObject: QueryObject,
@@ -53,23 +41,11 @@ export default function buildQueryContext(
       }
     | BuildFinalQueryObjects,
 ): QueryContext {
-  const {
-    queryFields,
-    buildQuery = WRAP_IN_ARRAY,
-    hooks = {},
-    ownState = {},
-  } = typeof options === 'function'
-    ? { buildQuery: options, queryFields: {} }
-    : options || {};
-  const queries = buildQuery(buildQueryObject(formData, queryFields), {
-    extras: {},
-    ownState,
-    hooks: {
-      setDataMask: () => {},
-      setCachedChanges: () => {},
-      ...hooks,
-    },
-  });
+  const { queryFields, buildQuery = WRAP_IN_ARRAY } =
+    typeof options === 'function'
+      ? { buildQuery: options, queryFields: {} }
+      : options || {};
+  const queries = buildQuery(buildQueryObject(formData, queryFields));
   queries.forEach(query => {
     if (Array.isArray(query.post_processing)) {
       // eslint-disable-next-line no-param-reassign
diff --git 
a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx 
b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx
index 797c750428..d7f2d7dd6d 100644
--- a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx
+++ b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton/index.tsx
@@ -26,9 +26,6 @@ import ModalTrigger from 'src/components/ModalTrigger';
 import { EmptyWrapperType } from 'src/components/TableView/TableView';
 
 interface EstimateQueryCostButtonProps {
-  dbId: number;
-  schema: string;
-  sql: string;
   getEstimate: Function;
   queryCostEstimate: Record<string, any>;
   selectedText?: string;
@@ -37,9 +34,6 @@ interface EstimateQueryCostButtonProps {
 }
 
 const EstimateQueryCostButton = ({
-  dbId,
-  schema,
-  sql,
   getEstimate,
   queryCostEstimate = {},
   selectedText,
diff --git a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx 
b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
index a01ff33a96..d40ca65f2f 100644
--- a/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
+++ b/superset-frontend/src/SqlLab/components/SqlEditor/index.jsx
@@ -686,9 +686,6 @@ class SqlEditor extends React.PureComponent {
             this.props.database.allows_cost_estimate && (
               <span>
                 <EstimateQueryCostButton
-                  dbId={qe.dbId}
-                  schema={qe.schema}
-                  sql={qe.sql}
                   getEstimate={this.getQueryCostEstimate}
                   queryCostEstimate={qe.queryCostEstimate}
                   selectedText={qe.selectedText}
diff --git 
a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx 
b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
index 6b39e18449..0fe14e15ed 100644
--- a/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
+++ b/superset-frontend/src/dashboard/components/SliceHeaderControls/index.tsx
@@ -213,7 +213,6 @@ class SliceHeaderControls extends React.PureComponent<
         downloadAsImage(
           getScreenshotNodeSelector(this.props.slice.slice_id),
           this.props.slice.slice_name,
-          {},
           true,
           // @ts-ignore
         )(domEvent).then(() => {
diff --git 
a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
 
b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
index f5fe459e4b..fe56777c4b 100644
--- 
a/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
+++ 
b/superset-frontend/src/dashboard/components/nativeFilters/FiltersConfigModal/FilterTitleContainer.tsx
@@ -146,36 +146,6 @@ const FilterTitleContainer = forwardRef<HTMLDivElement, 
Props>(
         </FilterTitle>
       );
     };
-    const recursivelyRender = (
-      elementId: string,
-      nodeList: Array<{ id: string; parentId: string | null }>,
-      rendered: Array<string>,
-    ): React.ReactNode => {
-      const didAlreadyRender = rendered.indexOf(elementId) >= 0;
-      if (didAlreadyRender) {
-        return null;
-      }
-      let parent = null;
-      const element = nodeList.filter(el => el.id === elementId)[0];
-      if (!element) {
-        return null;
-      }
-
-      rendered.push(elementId);
-      if (element.parentId) {
-        parent = recursivelyRender(element.parentId, nodeList, rendered);
-      }
-      const children = nodeList
-        .filter(item => item.parentId === elementId)
-        .map(item => recursivelyRender(item.id, nodeList, rendered));
-      return (
-        <>
-          {parent}
-          {renderComponent(elementId)}
-          {children}
-        </>
-      );
-    };
 
     const renderFilterGroups = () => {
       const items: React.ReactNode[] = [];
diff --git a/superset-frontend/src/filters/components/TimeColumn/buildQuery.ts 
b/superset-frontend/src/filters/components/TimeColumn/buildQuery.ts
index 1cc839c4cb..c271a69795 100644
--- a/superset-frontend/src/filters/components/TimeColumn/buildQuery.ts
+++ b/superset-frontend/src/filters/components/TimeColumn/buildQuery.ts
@@ -33,7 +33,7 @@ import { buildQueryContext, QueryFormData } from 
'@superset-ui/core';
  * if a viz needs multiple different result sets.
  */
 export default function buildQuery(formData: QueryFormData) {
-  return buildQueryContext(formData, baseQueryObject => [
+  return buildQueryContext(formData, () => [
     {
       result_type: 'columns',
       columns: [],
diff --git a/superset-frontend/src/middleware/asyncEvent.ts 
b/superset-frontend/src/middleware/asyncEvent.ts
index 9d252f99cc..9ae4f90e47 100644
--- a/superset-frontend/src/middleware/asyncEvent.ts
+++ b/superset-frontend/src/middleware/asyncEvent.ts
@@ -193,13 +193,13 @@ const wsConnect = (): void => {
   if (lastReceivedEventId) url += `?last_id=${lastReceivedEventId}`;
   ws = new WebSocket(url);
 
-  ws.addEventListener('open', event => {
+  ws.addEventListener('open', () => {
     logging.log('WebSocket connected');
     clearTimeout(wsConnectTimeout);
     wsConnectRetries = 0;
   });
 
-  ws.addEventListener('close', event => {
+  ws.addEventListener('close', () => {
     wsConnectTimeout = setTimeout(() => {
       wsConnectRetries += 1;
       if (wsConnectRetries <= wsConnectMaxRetries) {
@@ -211,7 +211,7 @@ const wsConnect = (): void => {
     }, wsConnectErrorDelay);
   });
 
-  ws.addEventListener('error', event => {
+  ws.addEventListener('error', () => {
     // https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/readyState
     if (ws.readyState < 2) ws.close();
   });
diff --git a/superset-frontend/src/utils/downloadAsImage.ts 
b/superset-frontend/src/utils/downloadAsImage.ts
index da9ca8b614..8c074bcdf2 100644
--- a/superset-frontend/src/utils/downloadAsImage.ts
+++ b/superset-frontend/src/utils/downloadAsImage.ts
@@ -17,7 +17,7 @@
  * under the License.
  */
 import { SyntheticEvent } from 'react';
-import domToImage, { Options } from 'dom-to-image';
+import domToImage from 'dom-to-image';
 import kebabCase from 'lodash/kebabCase';
 import { t } from '@superset-ui/core';
 import { addWarningToast } from 'src/components/MessageToasts/actions';
@@ -50,7 +50,6 @@ const generateFileStem = (description: string, date = new 
Date()) =>
 export default function downloadAsImage(
   selector: string,
   description: string,
-  domToImageOptions: Options = {},
   isExactSelector = false,
 ) {
   return (event: SyntheticEvent) => {
diff --git 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx
 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx
index 96a0bfef07..454070b52a 100644
--- 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx
+++ 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/SqlAlchemyForm.tsx
@@ -29,14 +29,12 @@ const SqlAlchemyTab = ({
   onInputChange,
   testConnection,
   conf,
-  isEditMode = false,
   testInProgress = false,
 }: {
   db: DatabaseObject | null;
   onInputChange: EventHandler<ChangeEvent<HTMLInputElement>>;
   testConnection: EventHandler<MouseEvent<HTMLElement>>;
   conf: { SQLALCHEMY_DOCS_URL: string; SQLALCHEMY_DISPLAY_TEXT: string };
-  isEditMode?: boolean;
   testInProgress?: boolean;
 }) => {
   let fallbackDocsUrl;
diff --git 
a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx 
b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index ca387a28a0..7891e6b0e2 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -1275,7 +1275,6 @@ const DatabaseModal: 
FunctionComponent<DatabaseModalProps> = ({
                 }
                 conf={conf}
                 testConnection={testConnection}
-                isEditMode={isEditMode}
                 testInProgress={testInProgress}
               />
               {isDynamic(db?.backend || db?.engine) && !isEditMode && (
diff --git a/superset-frontend/src/views/CRUD/data/query/QueryList.tsx 
b/superset-frontend/src/views/CRUD/data/query/QueryList.tsx
index da590f729a..6ab71b8d43 100644
--- a/superset-frontend/src/views/CRUD/data/query/QueryList.tsx
+++ b/superset-frontend/src/views/CRUD/data/query/QueryList.tsx
@@ -80,7 +80,7 @@ const StyledPopoverItem = styled.div`
   color: ${({ theme }) => theme.colors.grayscale.dark2};
 `;
 
-function QueryList({ addDangerToast, addSuccessToast }: QueryListProps) {
+function QueryList({ addDangerToast }: QueryListProps) {
   const {
     state: { loading, resourceCount: queryCount, resourceCollection: queries },
     fetchData,
diff --git 
a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx 
b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
index d2dc6aff9c..f3d58fe52c 100644
--- a/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
+++ b/superset-frontend/src/views/CRUD/data/savedquery/SavedQueryList.tsx
@@ -90,7 +90,6 @@ const StyledPopoverItem = styled.div`
 function SavedQueryList({
   addDangerToast,
   addSuccessToast,
-  user,
 }: SavedQueryListProps) {
   const {
     state: {

Reply via email to