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

@@ -104,7 +104,7 @@ export default class AdhocFilterControl extends React.Component {
})
.then(({ json }) => {
if (json && json.partitions) {
const partitions = json.partitions;
const { partitions } = json;
// for now only show latest_partition option
// when table datasource has only 1 partition key.
if (

View File

@@ -427,7 +427,7 @@ export default class AnnotationLayer extends React.PureComponent {
intervalEndColumn,
descriptionColumns,
} = this.state;
const slice = (valueOptions.find(x => x.value === value) || {}).slice;
const { slice } = valueOptions.find(x => x.value === value) || {};
if (sourceType !== ANNOTATION_SOURCE_TYPES.NATIVE && slice) {
const columns = (slice.data.groupby || [])
.concat(slice.data.all_columns || [])

View File

@@ -97,7 +97,7 @@ class DatasourceControl extends React.PureComponent {
}
renderDatasource() {
const datasource = this.props.datasource;
const { datasource } = this.props;
return (
<div className="m-t-10">
<Well className="m-t-0">

View File

@@ -207,7 +207,7 @@ class DateFilterControl extends React.Component {
untilViewMode: 'days',
};
const value = props.value;
const { value } = props;
if (value.indexOf(SEPARATOR) >= 0) {
this.state = { ...this.state, ...getStateFromSeparator(value) };
} else if (COMMON_TIME_FRAMES.indexOf(value) >= 0) {
@@ -282,7 +282,7 @@ class DateFilterControl extends React.Component {
}
handleClick(e) {
const target = e.target;
const { target } = e;
// switch to `TYPES.CUSTOM_START_END` when the calendar is clicked
if (this.startEndSectionRef && this.startEndSectionRef.contains(target)) {
this.setTypeCustomStartEnd();

View File

@@ -104,7 +104,7 @@ function coerceAdhocMetrics(value) {
}
function getDefaultAggregateForColumn(column) {
const type = column.type;
const { type } = column;
if (typeof type !== 'string') {
return AGGREGATES.COUNT;
} else if (type === '' || type === 'expression') {

View File

@@ -173,7 +173,7 @@ export default class SelectControl extends React.PureComponent {
}
handleKeyDownForCreate(event) {
const key = event.key;
const { key } = event;
if (key === 'Tab' || (this.props.commaChoosesOption && key === ',')) {
// simulate an Enter event
if (this.select) {

View File

@@ -74,7 +74,7 @@ export default class SpatialControl extends React.Component {
this.onChange();
}
onChange() {
const type = this.state.type;
const { type } = this.state;
const value = { type };
const errors = [];
const errMsg = t('Invalid lat/long configuration.');

View File

@@ -37,7 +37,7 @@ export default class TextControl extends React.Component<TextControlProps> {
this.onChange = this.onChange.bind(this);
}
onChange(event: any) {
let value = event.target.value;
let { value } = event.target;
// Validation & casting
const errors = [];