mirror of https://github.com/apache/superset.git
style: eslint curly rule (#11913)
* style: eslint curly rule * curly for ts
This commit is contained in:
parent
8c063efa75
commit
38b720b0a7
|
@ -80,6 +80,7 @@ module.exports = {
|
|||
'@typescript-eslint/explicit-module-boundary-types': 0, // re-enable up for discussion
|
||||
camelcase: 0,
|
||||
'class-methods-use-this': 0,
|
||||
curly: 1,
|
||||
'func-names': 0,
|
||||
'guard-for-in': 0,
|
||||
'import/no-cycle': 0, // re-enable up for discussion, might require some major refactors
|
||||
|
@ -189,6 +190,7 @@ module.exports = {
|
|||
},
|
||||
],
|
||||
'class-methods-use-this': 0,
|
||||
curly: 1,
|
||||
'func-names': 0,
|
||||
'guard-for-in': 0,
|
||||
'import/extensions': [
|
||||
|
|
|
@ -421,18 +421,21 @@ class DatasourceEditor extends React.PureComponent {
|
|||
SupersetClient.get({ endpoint })
|
||||
.then(({ json }) => {
|
||||
const results = this.updateColumns(json);
|
||||
if (results.modified.length)
|
||||
if (results.modified.length) {
|
||||
this.props.addSuccessToast(
|
||||
t('Modified columns: %s', results.modified.join(', ')),
|
||||
);
|
||||
if (results.removed.length)
|
||||
}
|
||||
if (results.removed.length) {
|
||||
this.props.addSuccessToast(
|
||||
t('Removed columns: %s', results.removed.join(', ')),
|
||||
);
|
||||
if (results.added.length)
|
||||
}
|
||||
if (results.added.length) {
|
||||
this.props.addSuccessToast(
|
||||
t('New columns added: %s', results.added.join(', ')),
|
||||
);
|
||||
}
|
||||
this.props.addSuccessToast(t('Metadata has been synced'));
|
||||
this.setState({ metadataLoading: false });
|
||||
})
|
||||
|
|
|
@ -57,10 +57,11 @@ export default function downloadAsImage(
|
|||
return (event: SyntheticEvent) => {
|
||||
const elementToPrint = event.currentTarget.closest(selector);
|
||||
|
||||
if (!elementToPrint)
|
||||
if (!elementToPrint) {
|
||||
return addWarningToast(
|
||||
t('Image download failed, please refresh and try again.'),
|
||||
);
|
||||
}
|
||||
|
||||
return domToImage
|
||||
.toJpeg(elementToPrint, {
|
||||
|
|
|
@ -167,7 +167,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
|
|||
original: { kind },
|
||||
},
|
||||
}: any) => {
|
||||
if (kind === 'physical')
|
||||
if (kind === 'physical') {
|
||||
return (
|
||||
<TooltipWrapper
|
||||
label="physical-dataset"
|
||||
|
@ -176,6 +176,7 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
|
|||
<Icon name="dataset-physical" />
|
||||
</TooltipWrapper>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<TooltipWrapper
|
||||
|
@ -582,8 +583,9 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
|
|||
const { virtualCount, physicalCount } = selected.reduce(
|
||||
(acc, e) => {
|
||||
if (e.original.kind === 'physical') acc.physicalCount += 1;
|
||||
else if (e.original.kind === 'virtual')
|
||||
else if (e.original.kind === 'virtual') {
|
||||
acc.virtualCount += 1;
|
||||
}
|
||||
return acc;
|
||||
},
|
||||
{ virtualCount: 0, physicalCount: 0 },
|
||||
|
|
|
@ -98,8 +98,9 @@ describe('QueryPreviewModal', () => {
|
|||
.first()
|
||||
.props();
|
||||
|
||||
if (typeof props.onClick === 'function')
|
||||
if (typeof props.onClick === 'function') {
|
||||
props.onClick({} as React.MouseEvent);
|
||||
}
|
||||
});
|
||||
|
||||
wrapper.update();
|
||||
|
@ -129,8 +130,9 @@ describe('QueryPreviewModal', () => {
|
|||
.find('[data-test="previous-query"]')
|
||||
.first()
|
||||
.props();
|
||||
if (typeof props.onClick === 'function')
|
||||
if (typeof props.onClick === 'function') {
|
||||
props.onClick({} as React.MouseEvent);
|
||||
}
|
||||
});
|
||||
|
||||
expect(mockedProps2.fetchData).toHaveBeenCalledWith(0);
|
||||
|
@ -141,8 +143,9 @@ describe('QueryPreviewModal', () => {
|
|||
it('calls fetchData with next index', () => {
|
||||
act(() => {
|
||||
const props = wrapper.find('[data-test="next-query"]').first().props();
|
||||
if (typeof props.onClick === 'function')
|
||||
if (typeof props.onClick === 'function') {
|
||||
props.onClick({} as React.MouseEvent);
|
||||
}
|
||||
});
|
||||
|
||||
expect(mockedProps.fetchData).toHaveBeenCalledWith(1);
|
||||
|
@ -170,8 +173,9 @@ describe('QueryPreviewModal', () => {
|
|||
.first()
|
||||
.props();
|
||||
|
||||
if (typeof props.onClick === 'function')
|
||||
if (typeof props.onClick === 'function') {
|
||||
props.onClick({} as React.MouseEvent);
|
||||
}
|
||||
|
||||
expect(mockedProps.openInSqlLab).toHaveBeenCalled();
|
||||
});
|
||||
|
|
|
@ -214,8 +214,9 @@ const SavedQueries = ({
|
|||
)}
|
||||
<Menu.Item
|
||||
onClick={() => {
|
||||
if (query.id)
|
||||
if (query.id) {
|
||||
copyQueryLink(query.id, addDangerToast, addSuccessToast);
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t('Share')}
|
||||
|
|
Loading…
Reference in New Issue