You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2024/02/15 21:10:39 UTC

(superset) branch Lint-cleanup created (now cc0ab1e678)

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

rusackas pushed a change to branch Lint-cleanup
in repository https://gitbox.apache.org/repos/asf/superset.git


      at cc0ab1e678 making the linter happy

This branch includes the following new commits:

     new e4bc6ccd5a better comments, enabling a few rules.
     new cb0982856a unused property
     new a3164972cc unused toggleShowDatasource
     new cc0ab1e678 making the linter happy

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(superset) 01/04: better comments, enabling a few rules.

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch Lint-cleanup
in repository https://gitbox.apache.org/repos/asf/superset.git

commit e4bc6ccd5a548b25f3631267947bfeb201fb2f3e
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Feb 15 13:29:26 2024 -0700

    better comments, enabling a few rules.
---
 superset-frontend/.eslintrc.js | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js
index 6ff6bc8a73..13b37a742f 100644
--- a/superset-frontend/.eslintrc.js
+++ b/superset-frontend/.eslintrc.js
@@ -162,7 +162,7 @@ module.exports = {
         'react/static-property-placement': 0, // re-enable up for discussion
         'prettier/prettier': 'error',
         'file-progress/activate': 1,
-        // delete me later: temporary rules to help with migration
+        // TODO: temporary rules to help with migration - please re-enable!
         'jsx-no-useless-fragment': 0,
         'react/function-component-definition': [
           0,
@@ -226,7 +226,7 @@ module.exports = {
         ],
         'no-only-tests/no-only-tests': 'error',
         'max-classes-per-file': 0,
-        // temporary rules to help with migration - please re-enable!
+        // TODO: temporary rules to help with migration - please re-enable!
         'testing-library/await-async-queries': 0,
         'testing-library/await-async-utils': 0,
         'testing-library/no-await-sync-events': 0,
@@ -261,6 +261,7 @@ module.exports = {
         'theme-colors/no-literal-colors': 0,
         'translation-vars/no-template-vars': 0,
         'no-restricted-imports': 0,
+        // TODO: temporary rules to help with migration - please re-enable!
         'jest/no-alias-methods': 0,
         'react/no-void-elements': 0,
       },
@@ -351,8 +352,10 @@ module.exports = {
     'react/static-property-placement': 0, // disabled temporarily
     'react-prefer-function-component/react-prefer-function-component': 1,
     'prettier/prettier': 'error',
-    // disabling some things that come with the eslint 7->8 upgrade. Will address these in a separate PR
-    'jest/no-alias-methods': 0,
+    // TODO: temporary rules to help with migration - please re-enable!
+    'jest/no-alias-methods': 2,
+    'no-promise-executor-return': 2,
+    'react/no-unused-class-component-methods': 2,
     'react/no-unknown-property': 0,
     'react/no-void-elements': 0,
     'react/function-component-definition': [
@@ -367,8 +370,6 @@ module.exports = {
     'no-import-assign': 0,
     'import/no-relative-packages': 0,
     'default-case-last': 0,
-    'no-promise-executor-return': 0,
-    'react/no-unused-class-component-methods': 0,
   },
   ignorePatterns,
 };


(superset) 04/04: making the linter happy

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch Lint-cleanup
in repository https://gitbox.apache.org/repos/asf/superset.git

commit cc0ab1e6788b13307eb6f096565da8627b230a03
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Feb 15 14:10:28 2024 -0700

    making the linter happy
---
 .../src/components/Datasource/DatasourceEditor.jsx | 40 ----------------------
 .../components/ColorSchemeControlWrapper.jsx       |  4 ---
 .../src/dashboard/components/dnd/DragDroppable.jsx |  9 -----
 .../FilterControl/AdhocFilterControl/index.jsx     |  2 --
 .../VizTypeControl/VizTypeControl.test.jsx         |  8 ++++-
 5 files changed, 7 insertions(+), 56 deletions(-)

diff --git a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
index cc18ec0fe4..02d4a39d4b 100644
--- a/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
+++ b/superset-frontend/src/components/Datasource/DatasourceEditor.jsx
@@ -27,8 +27,6 @@ import shortid from 'shortid';
 import {
   css,
   isFeatureEnabled,
-  getCurrencySymbol,
-  ensureIsArray,
   FeatureFlag,
   styled,
   SupersetClient,
@@ -50,7 +48,6 @@ import { getClientErrorObject } from 'src/utils/getClientErrorObject';
 import CheckboxControl from 'src/explore/components/controls/CheckboxControl';
 import TextControl from 'src/explore/components/controls/TextControl';
 import TextAreaControl from 'src/explore/components/controls/TextAreaControl';
-import SpatialControl from 'src/explore/components/controls/SpatialControl';
 import withToasts from 'src/components/MessageToasts/withToasts';
 import Icons from 'src/components/Icons';
 import CurrencyControl from 'src/explore/components/controls/CurrencyControl';
@@ -629,12 +626,6 @@ class DatasourceEditor extends React.PureComponent {
     this.setColumns = this.setColumns.bind(this);
     this.validateAndChange = this.validateAndChange.bind(this);
     this.handleTabSelect = this.handleTabSelect.bind(this);
-    this.currencies = ensureIsArray(props.currencies).map(currencyCode => ({
-      value: currencyCode,
-      label: `${getCurrencySymbol({
-        symbol: currencyCode,
-      })} (${currencyCode})`,
-    }));
   }
 
   onChange() {
@@ -1012,37 +1003,6 @@ class DatasourceEditor extends React.PureComponent {
     );
   }
 
-  renderSpatialTab() {
-    const { datasource } = this.state;
-    const { spatials, all_cols: allCols } = datasource;
-    return (
-      <Tabs.TabPane
-        tab={<CollectionTabTitle collection={spatials} title={t('Spatial')} />}
-        key={4}
-      >
-        <CollectionTable
-          tableColumns={['name', 'config']}
-          onChange={this.onDatasourcePropChange.bind(this, 'spatials')}
-          itemGenerator={() => ({
-            name: t('<new spatial>'),
-            type: t('<no type>'),
-            config: null,
-          })}
-          collection={spatials}
-          allowDeletes
-          itemRenderers={{
-            name: (d, onChange) => (
-              <EditableTitle canEdit title={d} onSaveTitle={onChange} />
-            ),
-            config: (v, onChange) => (
-              <SpatialControl value={v} onChange={onChange} choices={allCols} />
-            ),
-          }}
-        />
-      </Tabs.TabPane>
-    );
-  }
-
   renderSourceFieldset(theme) {
     const { datasource } = this.state;
     return (
diff --git a/superset-frontend/src/dashboard/components/ColorSchemeControlWrapper.jsx b/superset-frontend/src/dashboard/components/ColorSchemeControlWrapper.jsx
index 4a7839fdbb..9275fc9b02 100644
--- a/superset-frontend/src/dashboard/components/ColorSchemeControlWrapper.jsx
+++ b/superset-frontend/src/dashboard/components/ColorSchemeControlWrapper.jsx
@@ -45,10 +45,6 @@ class ColorSchemeControlWrapper extends React.PureComponent {
     this.schemes = this.categoricalSchemeRegistry.getMap();
   }
 
-  setHover(hovered) {
-    this.setState({ hovered });
-  }
-
   render() {
     const { colorScheme, labelMargin = 0, hasCustomLabelColors } = this.props;
     return (
diff --git a/superset-frontend/src/dashboard/components/dnd/DragDroppable.jsx b/superset-frontend/src/dashboard/components/dnd/DragDroppable.jsx
index 6a49f98875..593d84512e 100644
--- a/superset-frontend/src/dashboard/components/dnd/DragDroppable.jsx
+++ b/superset-frontend/src/dashboard/components/dnd/DragDroppable.jsx
@@ -147,16 +147,7 @@ export class UnwrappedDragDroppable extends React.PureComponent {
     this.setRef = this.setRef.bind(this);
   }
 
-  componentDidMount() {
-    this.mounted = true;
-  }
-
-  componentWillUnmount() {
-    this.mounted = false;
-  }
-
   setRef(ref) {
-    this.ref = ref;
     // this is needed for a custom drag preview
     if (this.props.useEmptyDragPreview) {
       this.props.dragPreviewRef(getEmptyImage(), {
diff --git a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx
index 7b6a3938fd..7a9cf3af2f 100644
--- a/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx
+++ b/superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.jsx
@@ -34,7 +34,6 @@ import {
   Operators,
   OPERATOR_ENUM_TO_OPERATOR_TYPE,
 } from 'src/explore/constants';
-import FilterDefinitionOption from 'src/explore/components/controls/MetricControl/FilterDefinitionOption';
 import {
   AddControlLabel,
   AddIconButton,
@@ -104,7 +103,6 @@ class AdhocFilterControl extends React.Component {
       isDictionaryForAdhocFilter(filter) ? new AdhocFilter(filter) : filter,
     );
 
-    this.optionRenderer = option => <FilterDefinitionOption option={option} />;
     this.valueRenderer = (adhocFilter, index) => (
       <AdhocFilterOption
         key={index}
diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx
index 67a6a19333..f742b93156 100644
--- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx
+++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.jsx
@@ -40,7 +40,13 @@ const defaultProps = {
  * on and prevents those warnings.
  */
 const waitForEffects = () =>
-  act(() => new Promise(resolve => setTimeout(resolve, 0)));
+  act(
+    () =>
+      new Promise(resolve => {
+        setTimeout(resolve, 0);
+        return undefined;
+      }),
+  );
 
 describe('VizTypeControl', () => {
   const registry = getChartMetadataRegistry();


(superset) 03/04: unused toggleShowDatasource

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch Lint-cleanup
in repository https://gitbox.apache.org/repos/asf/superset.git

commit a3164972cc5592b041d20710dd8945a1d457afe3
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Feb 15 13:41:19 2024 -0700

    unused toggleShowDatasource
---
 .../src/explore/components/controls/DatasourceControl/index.jsx     | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx b/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
index d72fe5f9e0..ff7cab8f3b 100644
--- a/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
+++ b/superset-frontend/src/explore/components/controls/DatasourceControl/index.jsx
@@ -213,12 +213,6 @@ class DatasourceControl extends React.PureComponent {
     }
   };
 
-  toggleShowDatasource = () => {
-    this.setState(({ showDatasource }) => ({
-      showDatasource: !showDatasource,
-    }));
-  };
-
   toggleChangeDatasourceModal = () => {
     this.setState(({ showChangeDatasourceModal }) => ({
       showChangeDatasourceModal: !showChangeDatasourceModal,


(superset) 02/04: unused property

Posted by ru...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch Lint-cleanup
in repository https://gitbox.apache.org/repos/asf/superset.git

commit cb0982856a4d9e52930ddc690e9ef2eec4b78f8a
Author: Evan Rusackas <ev...@rusackas.com>
AuthorDate: Thu Feb 15 13:31:32 2024 -0700

    unused property
---
 superset-frontend/src/components/Chart/Chart.jsx | 1 -
 1 file changed, 1 deletion(-)

diff --git a/superset-frontend/src/components/Chart/Chart.jsx b/superset-frontend/src/components/Chart/Chart.jsx
index 4b8e82975e..b4eb931225 100644
--- a/superset-frontend/src/components/Chart/Chart.jsx
+++ b/superset-frontend/src/components/Chart/Chart.jsx
@@ -244,7 +244,6 @@ class Chart extends React.PureComponent {
     } = this.props;
 
     const isLoading = chartStatus === 'loading';
-    this.renderContainerStartTime = Logger.getTimestamp();
     if (chartStatus === 'failed') {
       return queriesResponse.map(item => this.renderErrorMessage(item));
     }