mirror of
https://github.com/apache/superset.git
synced 2026-04-27 20:14:54 +00:00
Re-enable rule prefer-destructuring (only for objects) (#10867)
This commit is contained in:
committed by
GitHub
parent
c51168a30a
commit
352e8a1afd
@@ -237,7 +237,7 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
|
||||
});
|
||||
}
|
||||
getAceAnnotations() {
|
||||
const validationResult = this.props.queryEditor.validationResult;
|
||||
const { validationResult } = this.props.queryEditor;
|
||||
const resultIsReady = validationResult && validationResult.completed;
|
||||
if (resultIsReady && validationResult.errors.length > 0) {
|
||||
const errors = validationResult.errors.map((err: any) => ({
|
||||
|
||||
@@ -47,10 +47,10 @@ interface ColumnElementProps {
|
||||
}
|
||||
|
||||
export default function ColumnElement({ column }: ColumnElementProps) {
|
||||
let name: React.ReactNode = column.name;
|
||||
let columnName: React.ReactNode = column.name;
|
||||
let icons;
|
||||
if (column.keys && column.keys.length > 0) {
|
||||
name = <strong>{column.name}</strong>;
|
||||
columnName = <strong>{column.name}</strong>;
|
||||
icons = column.keys.map((key, i) => (
|
||||
<span key={i} className="ColumnElement">
|
||||
<OverlayTrigger
|
||||
@@ -73,7 +73,7 @@ export default function ColumnElement({ column }: ColumnElementProps) {
|
||||
return (
|
||||
<div className="clearfix table-column">
|
||||
<div className="pull-left m-l-10 col-name">
|
||||
{name}
|
||||
{columnName}
|
||||
{icons}
|
||||
</div>
|
||||
<div className="pull-right text-muted">
|
||||
|
||||
@@ -53,7 +53,7 @@ class ExploreResultsButton extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
onClick() {
|
||||
const timeout = this.props.timeout;
|
||||
const { timeout } = this.props;
|
||||
const msg = this.renderInvalidColumnMessage();
|
||||
if (Math.round(this.getQueryDuration()) > timeout) {
|
||||
this.dialog.show({
|
||||
@@ -86,7 +86,7 @@ class ExploreResultsButton extends React.PureComponent {
|
||||
}
|
||||
}
|
||||
getColumns() {
|
||||
const props = this.props;
|
||||
const { props } = this;
|
||||
if (
|
||||
props.query &&
|
||||
props.query.results &&
|
||||
|
||||
@@ -85,7 +85,7 @@ export default class LimitControl extends React.PureComponent<
|
||||
}
|
||||
|
||||
renderPopover() {
|
||||
const textValue = this.state.textValue;
|
||||
const { textValue } = this.state;
|
||||
const isValid = this.isValidLimit(textValue);
|
||||
const errorMsg =
|
||||
t('Row limit must be positive integer') +
|
||||
|
||||
@@ -148,9 +148,9 @@ export default class ResultSet extends React.PureComponent<
|
||||
}
|
||||
renderControls() {
|
||||
if (this.props.search || this.props.visualize || this.props.csv) {
|
||||
let data = this.props.query.results.data;
|
||||
let { data } = this.props.query.results;
|
||||
if (this.props.cache && this.props.query.cached) {
|
||||
data = this.state.data;
|
||||
({ data } = this.state);
|
||||
}
|
||||
return (
|
||||
<div className="ResultSetControls">
|
||||
@@ -199,7 +199,7 @@ export default class ResultSet extends React.PureComponent<
|
||||
return <div className="noControls" />;
|
||||
}
|
||||
render() {
|
||||
const query = this.props.query;
|
||||
const { query } = this.props;
|
||||
const height = Math.max(
|
||||
0,
|
||||
this.props.search ? this.props.height - SEARCH_HEIGHT : this.props.height,
|
||||
@@ -263,12 +263,12 @@ export default class ResultSet extends React.PureComponent<
|
||||
</div>
|
||||
);
|
||||
} else if (query.state === 'success' && query.results) {
|
||||
const results = query.results;
|
||||
const { results } = query;
|
||||
let data;
|
||||
if (this.props.cache && query.cached) {
|
||||
data = this.state.data;
|
||||
({ data } = this.state);
|
||||
} else if (results && results.data) {
|
||||
data = results.data;
|
||||
({ data } = results);
|
||||
}
|
||||
if (data && data.length > 0) {
|
||||
const expandedColumns = results.expanded_columns
|
||||
|
||||
@@ -94,7 +94,7 @@ export class SouthPane extends React.PureComponent {
|
||||
}
|
||||
const innerTabContentHeight = this.state.height - TAB_HEIGHT;
|
||||
let latestQuery;
|
||||
const props = this.props;
|
||||
const { props } = this;
|
||||
if (props.editorQueries.length > 0) {
|
||||
// get the latest query
|
||||
latestQuery = props.editorQueries.find(
|
||||
|
||||
@@ -129,7 +129,7 @@ class TabbedSqlEditors extends React.PureComponent {
|
||||
if (dbId) {
|
||||
dbId = parseInt(dbId, 10);
|
||||
} else {
|
||||
const databases = this.props.databases;
|
||||
const { databases } = this.props;
|
||||
const dbName = query.dbname;
|
||||
if (dbName) {
|
||||
Object.keys(databases).forEach(db => {
|
||||
|
||||
@@ -92,13 +92,13 @@ class TableElement extends React.PureComponent {
|
||||
}
|
||||
|
||||
renderWell() {
|
||||
const table = this.props.table;
|
||||
const { table } = this.props;
|
||||
let header;
|
||||
if (table.partitions) {
|
||||
let partitionQuery;
|
||||
let partitionClipBoard;
|
||||
if (table.partitions.partitionQuery) {
|
||||
partitionQuery = table.partitions.partitionQuery;
|
||||
({ partitionQuery } = table.partitions.partitionQuery);
|
||||
const tt = t('Copy partition query to clipboard');
|
||||
partitionClipBoard = (
|
||||
<CopyToClipboard
|
||||
@@ -129,7 +129,7 @@ class TableElement extends React.PureComponent {
|
||||
}
|
||||
renderControls() {
|
||||
let keyLink;
|
||||
const table = this.props.table;
|
||||
const { table } = this.props;
|
||||
if (table.indexes && table.indexes.length > 0) {
|
||||
keyLink = (
|
||||
<ModalTrigger
|
||||
@@ -191,7 +191,7 @@ class TableElement extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
renderHeader() {
|
||||
const table = this.props.table;
|
||||
const { table } = this.props;
|
||||
return (
|
||||
<div className="clearfix">
|
||||
<div className="pull-left">
|
||||
@@ -228,7 +228,7 @@ class TableElement extends React.PureComponent {
|
||||
);
|
||||
}
|
||||
renderBody() {
|
||||
const table = this.props.table;
|
||||
const { table } = this.props;
|
||||
let cols;
|
||||
if (table.columns) {
|
||||
cols = table.columns.slice();
|
||||
|
||||
Reference in New Issue
Block a user