You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2020/09/14 17:31:48 UTC

[incubator-superset] branch master updated: Re-enable rule no-unused-state (#10871)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 906a629  Re-enable rule no-unused-state (#10871)
906a629 is described below

commit 906a629b338b5f086ed9e1d094b0f4dcb2ac132f
Author: Kamil Gabryjelski <ka...@gmail.com>
AuthorDate: Mon Sep 14 19:31:16 2020 +0200

    Re-enable rule no-unused-state (#10871)
---
 superset-frontend/.eslintrc.js                          |  2 --
 superset-frontend/src/SqlLab/components/QuerySearch.jsx |  2 --
 superset-frontend/src/SqlLab/components/QueryTable.jsx  | 17 +----------------
 superset-frontend/src/SqlLab/components/SaveQuery.jsx   |  4 ++--
 superset-frontend/src/addSlice/AddSliceContainer.tsx    |  1 -
 .../src/dashboard/components/CssEditor.jsx              |  1 -
 superset-frontend/src/explore/components/SaveModal.jsx  |  2 --
 .../explore/components/controls/ColorSchemeControl.jsx  |  4 ----
 .../explore/components/controls/DatasourceControl.jsx   |  1 -
 9 files changed, 3 insertions(+), 31 deletions(-)

diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js
index 0410c52..15dba0a 100644
--- a/superset-frontend/.eslintrc.js
+++ b/superset-frontend/.eslintrc.js
@@ -130,7 +130,6 @@ module.exports = {
         'react/no-string-refs': 0,
         'react/no-unescaped-entities': 0,
         'react/no-unused-prop-types': 0,
-        'react/no-unused-state': 0, // disabled temporarily
         'react/prop-types': 0,
         'react/require-default-props': 0,
         'react/sort-comp': 0, // disabled temporarily
@@ -252,7 +251,6 @@ module.exports = {
     'react/no-string-refs': 0,
     'react/no-unescaped-entities': 0,
     'react/no-unused-prop-types': 0,
-    'react/no-unused-state': 0, // disabled temporarily
     'react/prop-types': 0,
     'react/require-default-props': 0,
     'react/sort-comp': 0, // disabled temporarily
diff --git a/superset-frontend/src/SqlLab/components/QuerySearch.jsx b/superset-frontend/src/SqlLab/components/QuerySearch.jsx
index cb517af..d794222 100644
--- a/superset-frontend/src/SqlLab/components/QuerySearch.jsx
+++ b/superset-frontend/src/SqlLab/components/QuerySearch.jsx
@@ -43,8 +43,6 @@ class QuerySearch extends React.PureComponent {
   constructor(props) {
     super(props);
     this.state = {
-      userLoading: false,
-      userOptions: [],
       databaseId: null,
       userId: null,
       searchText: null,
diff --git a/superset-frontend/src/SqlLab/components/QueryTable.jsx b/superset-frontend/src/SqlLab/components/QueryTable.jsx
index e92940d..2a23acd 100644
--- a/superset-frontend/src/SqlLab/components/QueryTable.jsx
+++ b/superset-frontend/src/SqlLab/components/QueryTable.jsx
@@ -48,26 +48,11 @@ const defaultProps = {
 };
 
 class QueryTable extends React.PureComponent {
-  constructor(props) {
-    super(props);
-    const uri = window.location.toString();
-    const cleanUri = uri.substring(0, uri.indexOf('#'));
-    this.state = {
-      cleanUri,
-      showVisualizeModal: false,
-      activeQuery: null,
-    };
-  }
   openQuery(id) {
     const url = `/superset/sqllab?queryId=${id}`;
     window.open(url);
   }
-  hideVisualizeModal() {
-    this.setState({ showVisualizeModal: false });
-  }
-  showVisualizeModal(query) {
-    this.setState({ activeQuery: query, showVisualizeModal: true });
-  }
+
   restoreSql(query) {
     this.props.actions.queryEditorSetSql({ id: query.sqlEditorId }, query.sql);
   }
diff --git a/superset-frontend/src/SqlLab/components/SaveQuery.jsx b/superset-frontend/src/SqlLab/components/SaveQuery.jsx
index ccb075d..e7ed408 100644
--- a/superset-frontend/src/SqlLab/components/SaveQuery.jsx
+++ b/superset-frontend/src/SqlLab/components/SaveQuery.jsx
@@ -82,8 +82,8 @@ class SaveQuery extends React.PureComponent {
   close() {
     if (this.saveModal) this.saveModal.close();
   }
-  toggleSave(e) {
-    this.setState({ target: e.target, showSave: !this.state.showSave });
+  toggleSave() {
+    this.setState({ showSave: !this.state.showSave });
   }
   renderModalBody() {
     const isSaved = !!this.props.query.remoteId;
diff --git a/superset-frontend/src/addSlice/AddSliceContainer.tsx b/superset-frontend/src/addSlice/AddSliceContainer.tsx
index 0180839..f42b977 100644
--- a/superset-frontend/src/addSlice/AddSliceContainer.tsx
+++ b/superset-frontend/src/addSlice/AddSliceContainer.tsx
@@ -75,7 +75,6 @@ export default class AddSliceContainer extends React.PureComponent<
     this.setState({
       datasourceValue: option.value,
       datasourceId: option.value.split('__')[0],
-      datasourceType: option.value.split('__')[1],
     });
   }
 
diff --git a/superset-frontend/src/dashboard/components/CssEditor.jsx b/superset-frontend/src/dashboard/components/CssEditor.jsx
index 4048cd8..a412f6d 100644
--- a/superset-frontend/src/dashboard/components/CssEditor.jsx
+++ b/superset-frontend/src/dashboard/components/CssEditor.jsx
@@ -44,7 +44,6 @@ class CssEditor extends React.PureComponent {
     super(props);
     this.state = {
       css: props.initialCss,
-      cssTemplateOptions: [],
     };
     this.changeCss = this.changeCss.bind(this);
     this.changeCssTemplate = this.changeCssTemplate.bind(this);
diff --git a/superset-frontend/src/explore/components/SaveModal.jsx b/superset-frontend/src/explore/components/SaveModal.jsx
index 4e36e04..d20d3e9 100644
--- a/superset-frontend/src/explore/components/SaveModal.jsx
+++ b/superset-frontend/src/explore/components/SaveModal.jsx
@@ -49,10 +49,8 @@ class SaveModal extends React.Component {
     this.state = {
       saveToDashboardId: null,
       newSliceName: props.sliceName,
-      dashboards: [],
       alert: null,
       action: props.can_overwrite ? 'overwrite' : 'saveas',
-      vizType: props.form_data.viz_type,
     };
     this.onDashboardSelectChange = this.onDashboardSelectChange.bind(this);
     this.onSliceNameChange = this.onSliceNameChange.bind(this);
diff --git a/superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx b/superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx
index 60f91ac..4b9d6e4 100644
--- a/superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx
+++ b/superset-frontend/src/explore/components/controls/ColorSchemeControl.jsx
@@ -50,9 +50,6 @@ const defaultProps = {
 export default class ColorSchemeControl extends React.PureComponent {
   constructor(props) {
     super(props);
-    this.state = {
-      scheme: this.props.value,
-    };
     this.onChange = this.onChange.bind(this);
     this.renderOption = this.renderOption.bind(this);
   }
@@ -60,7 +57,6 @@ export default class ColorSchemeControl extends React.PureComponent {
   onChange(option) {
     const optionValue = option ? option.value : null;
     this.props.onChange(optionValue);
-    this.setState({ scheme: optionValue });
   }
 
   renderOption(key) {
diff --git a/superset-frontend/src/explore/components/controls/DatasourceControl.jsx b/superset-frontend/src/explore/components/controls/DatasourceControl.jsx
index e12d837..69c5e71 100644
--- a/superset-frontend/src/explore/components/controls/DatasourceControl.jsx
+++ b/superset-frontend/src/explore/components/controls/DatasourceControl.jsx
@@ -60,7 +60,6 @@ class DatasourceControl extends React.PureComponent {
     this.state = {
       showEditDatasourceModal: false,
       showChangeDatasourceModal: false,
-      menuExpanded: false,
     };
     this.onDatasourceSave = this.onDatasourceSave.bind(this);
     this.toggleChangeDatasourceModal = this.toggleChangeDatasourceModal.bind(