mirror of
https://github.com/apache/superset.git
synced 2026-05-11 19:05:24 +00:00
Re-enable rule no-else-return (#10861)
This commit is contained in:
committed by
GitHub
parent
76275ec410
commit
2d8f4e3aaf
@@ -60,11 +60,14 @@ const defaultProps = {
|
||||
function translateOperator(operator) {
|
||||
if (operator === OPERATORS['==']) {
|
||||
return 'equals';
|
||||
} else if (operator === OPERATORS['!=']) {
|
||||
}
|
||||
if (operator === OPERATORS['!=']) {
|
||||
return 'not equal to';
|
||||
} else if (operator === OPERATORS.LIKE) {
|
||||
}
|
||||
if (operator === OPERATORS.LIKE) {
|
||||
return 'like';
|
||||
} else if (operator === OPERATORS['LATEST PARTITION']) {
|
||||
}
|
||||
if (operator === OPERATORS['LATEST PARTITION']) {
|
||||
return 'use latest_partition template';
|
||||
}
|
||||
return operator;
|
||||
|
||||
@@ -142,10 +142,12 @@ class ControlPanelsContainer extends React.Component {
|
||||
if (!controlItem) {
|
||||
// When the item is invalid
|
||||
return null;
|
||||
} else if (React.isValidElement(controlItem)) {
|
||||
}
|
||||
if (React.isValidElement(controlItem)) {
|
||||
// When the item is a React element
|
||||
return controlItem;
|
||||
} else if (controlItem.name && controlItem.config) {
|
||||
}
|
||||
if (controlItem.name && controlItem.config) {
|
||||
return this.renderControl(controlItem);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -133,9 +133,11 @@ export class DisplayQueryButton extends React.PureComponent {
|
||||
renderQueryModalBody() {
|
||||
if (this.state.isLoading) {
|
||||
return <Loading />;
|
||||
} else if (this.state.error) {
|
||||
}
|
||||
if (this.state.error) {
|
||||
return <pre>{this.state.error}</pre>;
|
||||
} else if (this.state.query) {
|
||||
}
|
||||
if (this.state.query) {
|
||||
return (
|
||||
<div>
|
||||
<CopyToClipboard
|
||||
@@ -158,9 +160,11 @@ export class DisplayQueryButton extends React.PureComponent {
|
||||
renderResultsModalBody() {
|
||||
if (this.state.isLoading) {
|
||||
return <Loading />;
|
||||
} else if (this.state.error) {
|
||||
}
|
||||
if (this.state.error) {
|
||||
return <pre>{this.state.error}</pre>;
|
||||
} else if (this.state.data) {
|
||||
}
|
||||
if (this.state.data) {
|
||||
if (this.state.data.length === 0) {
|
||||
return 'No data';
|
||||
}
|
||||
@@ -212,9 +216,11 @@ export class DisplayQueryButton extends React.PureComponent {
|
||||
renderSamplesModalBody() {
|
||||
if (this.state.isLoading) {
|
||||
return <Loading />;
|
||||
} else if (this.state.error) {
|
||||
}
|
||||
if (this.state.error) {
|
||||
return <pre>{this.state.error}</pre>;
|
||||
} else if (this.state.data) {
|
||||
}
|
||||
if (this.state.data) {
|
||||
return this.renderDataTable(this.state.data);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -40,9 +40,11 @@ export default function FilterDefinitionOption({ option }) {
|
||||
<span className="option-label">{option.saved_metric_name}</span>
|
||||
</div>
|
||||
);
|
||||
} else if (option.column_name) {
|
||||
}
|
||||
if (option.column_name) {
|
||||
return <ColumnOption column={option} showType />;
|
||||
} else if (option.label) {
|
||||
}
|
||||
if (option.label) {
|
||||
return <AdhocMetricStaticOption adhocMetric={option} showType />;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +38,11 @@ const propTypes = {
|
||||
function MetricDefinitionOption({ option, addWarningToast }) {
|
||||
if (option.metric_name) {
|
||||
return <MetricOption metric={option} showType />;
|
||||
} else if (option.column_name) {
|
||||
}
|
||||
if (option.column_name) {
|
||||
return <ColumnOption column={option} showType />;
|
||||
} else if (option.aggregate_name) {
|
||||
}
|
||||
if (option.aggregate_name) {
|
||||
return <AggregateOption aggregate={option} showType />;
|
||||
}
|
||||
addWarningToast(
|
||||
|
||||
@@ -107,26 +107,32 @@ function getDefaultAggregateForColumn(column) {
|
||||
const { type } = column;
|
||||
if (typeof type !== 'string') {
|
||||
return AGGREGATES.COUNT;
|
||||
} else if (type === '' || type === 'expression') {
|
||||
}
|
||||
if (type === '' || type === 'expression') {
|
||||
return AGGREGATES.SUM;
|
||||
} else if (
|
||||
}
|
||||
if (
|
||||
type.match(/.*char.*/i) ||
|
||||
type.match(/string.*/i) ||
|
||||
type.match(/.*text.*/i)
|
||||
) {
|
||||
return AGGREGATES.COUNT_DISTINCT;
|
||||
} else if (
|
||||
}
|
||||
if (
|
||||
type.match(/.*int.*/i) ||
|
||||
type === 'LONG' ||
|
||||
type === 'DOUBLE' ||
|
||||
type === 'FLOAT'
|
||||
) {
|
||||
return AGGREGATES.SUM;
|
||||
} else if (type.match(/.*bool.*/i)) {
|
||||
}
|
||||
if (type.match(/.*bool.*/i)) {
|
||||
return AGGREGATES.MAX;
|
||||
} else if (type.match(/.*time.*/i)) {
|
||||
}
|
||||
if (type.match(/.*time.*/i)) {
|
||||
return AGGREGATES.COUNT;
|
||||
} else if (type.match(/unknown/i)) {
|
||||
}
|
||||
if (type.match(/unknown/i)) {
|
||||
return AGGREGATES.COUNT;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -119,9 +119,11 @@ export default class SpatialControl extends React.Component {
|
||||
}
|
||||
if (this.state.type === spatialTypes.latlong) {
|
||||
return `${this.state.lonCol} | ${this.state.latCol}`;
|
||||
} else if (this.state.type === spatialTypes.delimited) {
|
||||
}
|
||||
if (this.state.type === spatialTypes.delimited) {
|
||||
return `${this.state.lonlatCol}`;
|
||||
} else if (this.state.type === spatialTypes.geohash) {
|
||||
}
|
||||
if (this.state.type === spatialTypes.geohash) {
|
||||
return `${this.state.geohashCol}`;
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user