From 2d8f4e3aaf28779f0a5a8e2c6509c0d9824925cd Mon Sep 17 00:00:00 2001 From: Kamil Gabryjelski Date: Mon, 14 Sep 2020 22:00:07 +0200 Subject: [PATCH] Re-enable rule no-else-return (#10861) --- superset-frontend/.eslintrc.js | 2 -- .../components/EstimateQueryCostButton.jsx | 3 ++- .../src/SqlLab/components/ResultSet.tsx | 15 ++++++++---- .../components/RunQueryActionButton.tsx | 3 ++- .../src/SqlLab/components/TableElement.jsx | 3 ++- superset-frontend/src/chart/chartReducer.js | 3 ++- .../src/components/AlteredSliceTag.jsx | 24 ++++++++++++------- .../FilterableTable/FilterableTable.tsx | 9 ++++--- .../src/components/Menu/Menu.tsx | 3 ++- .../src/components/Menu/MenuObject.tsx | 3 ++- .../src/components/ModalTrigger.jsx | 3 ++- .../components/FilterIndicatorsContainer.jsx | 3 ++- .../dashboard/components/PublishedStatus.jsx | 2 +- .../src/dashboard/components/SliceAdder.jsx | 3 ++- .../components/gridComponents/Markdown.jsx | 3 ++- .../dashboard/reducers/dashboardFilters.js | 9 ++++--- .../util/getComponentWidthFromDrop.js | 6 +++-- .../util/logging/findNonTabChildChartIds.js | 3 ++- superset-frontend/src/explore/AdhocFilter.js | 3 ++- superset-frontend/src/explore/AdhocMetric.js | 6 +++-- ...AdhocFilterEditPopoverSimpleTabContent.jsx | 9 ++++--- .../components/ControlPanelsContainer.jsx | 6 +++-- .../explore/components/DisplayQueryButton.jsx | 18 +++++++++----- .../components/FilterDefinitionOption.jsx | 6 +++-- .../components/MetricDefinitionOption.jsx | 6 +++-- .../components/controls/MetricsControl.jsx | 18 +++++++++----- .../components/controls/SpatialControl.jsx | 6 +++-- superset-frontend/src/explore/controlUtils.js | 3 ++- superset-frontend/src/utils/common.js | 12 ++++++---- .../views/CRUD/data/dataset/DatasetList.tsx | 6 +++-- .../visualizations/TimeTable/TimeTable.jsx | 6 +++-- 31 files changed, 135 insertions(+), 70 deletions(-) diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js index de634b87e8..f0430e1bf1 100644 --- a/superset-frontend/.eslintrc.js +++ b/superset-frontend/.eslintrc.js @@ -89,7 +89,6 @@ module.exports = { 'new-cap': 0, 'no-bitwise': 0, 'no-continue': 0, - 'no-else-return': 0, // disabled temporarily 'no-mixed-operators': 0, 'no-multi-assign': 0, 'no-multi-spaces': 0, @@ -203,7 +202,6 @@ module.exports = { 'jsx-a11y/mouse-events-have-key-events': 0, // re-enable up for discussion 'lines-between-class-members': 0, // disabled temporarily 'new-cap': 0, - 'no-else-return': 0, // disabled temporarily 'no-bitwise': 0, 'no-continue': 0, 'no-mixed-operators': 0, diff --git a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton.jsx b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton.jsx index 1c9612f6be..78f2b2f30f 100644 --- a/superset-frontend/src/SqlLab/components/EstimateQueryCostButton.jsx +++ b/superset-frontend/src/SqlLab/components/EstimateQueryCostButton.jsx @@ -61,7 +61,8 @@ class EstimateQueryCostButton extends React.PureComponent { {this.props.queryCostEstimate.error} ); - } else if (this.props.queryCostEstimate.completed) { + } + if (this.props.queryCostEstimate.completed) { return ( Query was stopped; - } else if (query.state === 'failed') { + } + if (query.state === 'failed') { return (
); - } else if (query.state === 'success' && query.ctas) { + } + if (query.state === 'success' && query.ctas) { const { tempSchema, tempTable } = query; let object = 'Table'; if (query.ctas_method === CtasEnum.VIEW) { @@ -262,7 +264,8 @@ export default class ResultSet extends React.PureComponent< ); - } else if (query.state === 'success' && query.results) { + } + if (query.state === 'success' && query.results) { const { results } = query; let data; if (this.props.cache && query.cached) { @@ -287,7 +290,8 @@ export default class ResultSet extends React.PureComponent< /> ); - } else if (data && data.length === 0) { + } + if (data && data.length === 0) { return ( {t('The query returned no data')} ); @@ -310,7 +314,8 @@ export default class ResultSet extends React.PureComponent< {t('Fetch data preview')} ); - } else if (query.resultsKey) { + } + if (query.resultsKey) { return ( ); - } else if (allowAsync) { + } + if (allowAsync) { return (