diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js index 085b31b749..b7306914ae 100644 --- a/superset-frontend/.eslintrc.js +++ b/superset-frontend/.eslintrc.js @@ -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': [ diff --git a/superset-frontend/src/datasource/DatasourceEditor.jsx b/superset-frontend/src/datasource/DatasourceEditor.jsx index e6b21d5d33..0a730bf4b9 100644 --- a/superset-frontend/src/datasource/DatasourceEditor.jsx +++ b/superset-frontend/src/datasource/DatasourceEditor.jsx @@ -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 }); }) diff --git a/superset-frontend/src/utils/downloadAsImage.ts b/superset-frontend/src/utils/downloadAsImage.ts index 9aaa831c3b..800dc7251f 100644 --- a/superset-frontend/src/utils/downloadAsImage.ts +++ b/superset-frontend/src/utils/downloadAsImage.ts @@ -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, { diff --git a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx index f31da4ce05..a01f947387 100644 --- a/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx +++ b/superset-frontend/src/views/CRUD/data/dataset/DatasetList.tsx @@ -167,7 +167,7 @@ const DatasetList: FunctionComponent = ({ original: { kind }, }, }: any) => { - if (kind === 'physical') + if (kind === 'physical') { return ( = ({ ); + } return ( = ({ 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 }, diff --git a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.test.tsx b/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.test.tsx index 85fc22a1ab..0407c7635e 100644 --- a/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.test.tsx +++ b/superset-frontend/src/views/CRUD/data/query/QueryPreviewModal.test.tsx @@ -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(); }); diff --git a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx b/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx index 6232ec176f..0ef57897d7 100644 --- a/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx +++ b/superset-frontend/src/views/CRUD/welcome/SavedQueries.tsx @@ -214,8 +214,9 @@ const SavedQueries = ({ )} { - if (query.id) + if (query.id) { copyQueryLink(query.id, addDangerToast, addSuccessToast); + } }} > {t('Share')}