Re-enable rule prefer-destructuring (only for objects) (#10867)

This commit is contained in:
Kamil Gabryjelski
2020-09-14 19:11:20 +02:00
committed by GitHub
parent c51168a30a
commit 352e8a1afd
53 changed files with 80 additions and 83 deletions

View File

@@ -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) => ({

View File

@@ -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">

View File

@@ -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 &&

View File

@@ -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') +

View File

@@ -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

View File

@@ -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(

View File

@@ -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 => {

View File

@@ -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();