Skip to content

Commit

Permalink
Re-enable rule no-unused-state (#10871)
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Sep 14, 2020
1 parent 352e8a1 commit 906a629
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 31 deletions.
2 changes: 0 additions & 2 deletions superset-frontend/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions superset-frontend/src/SqlLab/components/QuerySearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ class QuerySearch extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
userLoading: false,
userOptions: [],
databaseId: null,
userId: null,
searchText: null,
Expand Down
17 changes: 1 addition & 16 deletions superset-frontend/src/SqlLab/components/QueryTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/SqlLab/components/SaveQuery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion superset-frontend/src/addSlice/AddSliceContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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],
});
}

Expand Down
1 change: 0 additions & 1 deletion superset-frontend/src/dashboard/components/CssEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions superset-frontend/src/explore/components/SaveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,13 @@ 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);
}

onChange(option) {
const optionValue = option ? option.value : null;
this.props.onChange(optionValue);
this.setState({ scheme: optionValue });
}

renderOption(key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 906a629

Please sign in to comment.