From 91b8c8afc9098653b71d9e5855499717ec44145b Mon Sep 17 00:00:00 2001 From: Kamil Gabryjelski Date: Mon, 14 Sep 2020 22:31:11 +0200 Subject: [PATCH] Re-enable rule state-in-constructor (#10873) --- superset-frontend/.eslintrc.js | 2 -- .../src/views/CRUD/welcome/DashboardTable.tsx | 13 ++++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/superset-frontend/.eslintrc.js b/superset-frontend/.eslintrc.js index 11a03bdeb..d1cbd2ce0 100644 --- a/superset-frontend/.eslintrc.js +++ b/superset-frontend/.eslintrc.js @@ -125,7 +125,6 @@ module.exports = { 'react/no-unused-prop-types': 0, 'react/prop-types': 0, 'react/require-default-props': 0, - 'react/state-in-constructor': 0, // disabled temporarily 'react/static-property-placement': 0, // re-enable up for discussion 'prettier/prettier': 'error', }, @@ -239,7 +238,6 @@ module.exports = { 'react/no-unused-prop-types': 0, 'react/prop-types': 0, 'react/require-default-props': 0, - 'react/state-in-constructor': 0, // disabled temporarily 'react/static-property-placement': 0, // disabled temporarily 'prettier/prettier': 'error', }, diff --git a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx index 8e04ea7cb..b3990f4db 100644 --- a/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx +++ b/superset-frontend/src/views/CRUD/welcome/DashboardTable.tsx @@ -92,11 +92,14 @@ class DashboardTable extends React.PureComponent< initialSort = [{ id: 'changed_on_delta_humanized', desc: true }]; - state = { - dashboards: [], - dashboard_count: 0, - loading: false, - }; + constructor(props: DashboardTableProps) { + super(props); + this.state = { + dashboards: [], + dashboard_count: 0, + loading: false, + }; + } componentDidUpdate(prevProps: DashboardTableProps) { if (prevProps.search !== this.props.search) {