diff --git a/package.json b/package.json index 2a812fee63405993c8dd2cb2e186de54da380dc9..77d77194957d44ee2188490abf32d845a855bbff 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "@types/react-dom": "^16.0.6", "antd-pro-merge-less": "^0.0.9", "antd-pro-theme-webpack-plugin": "^1.1.8", - "babel-eslint": "^8.2.6", + "babel-eslint": "^9.0.0", "cross-env": "^5.1.1", "cross-port-killer": "^1.0.1", "enzyme": "^3.4.4", diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js index 093587d43c30233b8d8c5e63d8ff1c452124eb78..450de00cb03c6b86aad5e28a9600a5cc66e49bbd 100644 --- a/src/components/Charts/Gauge/index.js +++ b/src/components/Charts/Gauge/index.js @@ -51,8 +51,9 @@ Shape.registerShape('point', 'pointer', { }, }); +export default @autoHeight() -export default class Gauge extends React.Component { +class Gauge extends React.Component { render() { const { title, diff --git a/src/components/Charts/MiniArea/index.js b/src/components/Charts/MiniArea/index.js index 151fdd1cd8b37d9de33b859444ae10b47d1a74c4..77a19a6ff35112fec1492fd1e0ba019254639d30 100644 --- a/src/components/Charts/MiniArea/index.js +++ b/src/components/Charts/MiniArea/index.js @@ -3,8 +3,9 @@ import { Chart, Axis, Tooltip, Geom } from 'bizcharts'; import autoHeight from '../autoHeight'; import styles from '../index.less'; +export default @autoHeight() -export default class MiniArea extends React.PureComponent { +class MiniArea extends React.PureComponent { render() { const { height, diff --git a/src/components/Charts/MiniBar/index.js b/src/components/Charts/MiniBar/index.js index 92ee6b510346626899a21baf7cdace20e03f3091..c9b561015c3780c58ae2d4c6242eab6c90dae67b 100644 --- a/src/components/Charts/MiniBar/index.js +++ b/src/components/Charts/MiniBar/index.js @@ -3,8 +3,9 @@ import { Chart, Tooltip, Geom } from 'bizcharts'; import autoHeight from '../autoHeight'; import styles from '../index.less'; +export default @autoHeight() -export default class MiniBar extends React.Component { +class MiniBar extends React.Component { render() { const { height, forceFit = true, color = '#1890FF', data = [] } = this.props; diff --git a/src/components/Charts/Pie/index.js b/src/components/Charts/Pie/index.js index 1dc0e92ffc06cc2b5776826be63e0535e3fdc14c..124fb748e332d3af5ef1101bba127f9e05cc8891 100644 --- a/src/components/Charts/Pie/index.js +++ b/src/components/Charts/Pie/index.js @@ -11,8 +11,9 @@ import autoHeight from '../autoHeight'; import styles from './index.less'; /* eslint react/no-danger:0 */ +export default @autoHeight() -export default class Pie extends Component { +class Pie extends Component { state = { legendData: [], legendBlock: false, diff --git a/src/components/Charts/Radar/index.js b/src/components/Charts/Radar/index.js index beb88b77c9fe663342d138973cf728e82696821a..55137dc62cc4573f38717edc3c96727a575576c3 100644 --- a/src/components/Charts/Radar/index.js +++ b/src/components/Charts/Radar/index.js @@ -5,8 +5,9 @@ import autoHeight from '../autoHeight'; import styles from './index.less'; /* eslint react/no-danger:0 */ +export default @autoHeight() -export default class Radar extends Component { +class Radar extends Component { state = { legendData: [], }; diff --git a/src/components/Charts/TimelineChart/index.js b/src/components/Charts/TimelineChart/index.js index 018464da5ea3c9f2dbe1d548bf9ec8038c753550..1f7b43f761842124807252f42d7640b36e0d6bab 100644 --- a/src/components/Charts/TimelineChart/index.js +++ b/src/components/Charts/TimelineChart/index.js @@ -5,8 +5,9 @@ import Slider from 'bizcharts-plugin-slider'; import autoHeight from '../autoHeight'; import styles from './index.less'; +export default @autoHeight() -export default class TimelineChart extends React.Component { +class TimelineChart extends React.Component { render() { const { title, diff --git a/src/components/Charts/WaterWave/index.js b/src/components/Charts/WaterWave/index.js index f25ef75161a174329355f39a6b8e0609b83c37d3..0fd61a957af2066b12a14fce53f02659f1b87686 100644 --- a/src/components/Charts/WaterWave/index.js +++ b/src/components/Charts/WaterWave/index.js @@ -6,8 +6,9 @@ import styles from './index.less'; /* eslint no-mixed-operators: 0 */ // riddle: https://riddle.alibaba-inc.com/riddles/2d9a4b90 +export default @autoHeight() -export default class WaterWave extends PureComponent { +class WaterWave extends PureComponent { state = { radio: 1, }; diff --git a/src/pages/Account/Center/Applications.js b/src/pages/Account/Center/Applications.js index 114325bb99d700119dcdf828bf28e3f84e69318e..54d1ff87590408581520ed1d2c77b6e34d239aca 100644 --- a/src/pages/Account/Center/Applications.js +++ b/src/pages/Account/Center/Applications.js @@ -5,10 +5,11 @@ import { connect } from 'dva'; import { formatWan } from '@/utils/utils'; import stylesApplications from '../../List/Applications.less'; +export default @connect(({ list }) => ({ list, })) -export default class Center extends PureComponent { +class Center extends PureComponent { render() { const { list: { list }, diff --git a/src/pages/Account/Center/Articles.js b/src/pages/Account/Center/Articles.js index ece186173ff77e752afc1f2cf094b2c2d4ddd686..fb42f2a9216a97896efc64e6bd914e53186d412e 100644 --- a/src/pages/Account/Center/Articles.js +++ b/src/pages/Account/Center/Articles.js @@ -5,10 +5,11 @@ import { connect } from 'dva'; import stylesArticles from '../../List/Articles.less'; import styles from './Articles.less'; +export default @connect(({ list }) => ({ list, })) -export default class Center extends PureComponent { +class Center extends PureComponent { render() { const { list: { list }, diff --git a/src/pages/Account/Center/Center.js b/src/pages/Account/Center/Center.js index 0d699ecb9d185472cd1fd33df166bd7740fdfaba..786e0cd8b5b43af39bc5ef2246d004bda0fc9b2f 100644 --- a/src/pages/Account/Center/Center.js +++ b/src/pages/Account/Center/Center.js @@ -6,6 +6,7 @@ import { Card, Row, Col, Icon, Avatar, Tag, Divider, Spin, Input } from 'antd'; import GridContent from '@/components/PageHeaderWrapper/GridContent'; import styles from './Center.less'; +export default @connect(({ loading, user, project }) => ({ listLoading: loading.effects['list/fetch'], currentUser: user.currentUser, @@ -13,7 +14,7 @@ import styles from './Center.less'; project, projectLoading: loading.effects['project/fetchNotice'], })) -export default class Center extends PureComponent { +class Center extends PureComponent { state = { newTags: [], inputVisible: false, diff --git a/src/pages/Account/Center/Projects.js b/src/pages/Account/Center/Projects.js index 74af5e1681c91dfabdef18e9f9141ff234ff6a23..c4e389ab7a7ef33002c8b9a94c524e0f0d543a4f 100644 --- a/src/pages/Account/Center/Projects.js +++ b/src/pages/Account/Center/Projects.js @@ -5,10 +5,11 @@ import { connect } from 'dva'; import AvatarList from '@/components/AvatarList'; import stylesProjects from '../../List/Projects.less'; +export default @connect(({ list }) => ({ list, })) -export default class Center extends PureComponent { +class Center extends PureComponent { render() { const { list: { list }, diff --git a/src/pages/Account/Settings/GeographicView.js b/src/pages/Account/Settings/GeographicView.js index b4f7a99b1b956ad08677a9afbd5d352e3368d568..8d6925cd207190473c8513045a45df1acd69bb7f 100644 --- a/src/pages/Account/Settings/GeographicView.js +++ b/src/pages/Account/Settings/GeographicView.js @@ -10,6 +10,7 @@ const nullSlectItem = { key: '', }; +export default @connect(({ geographic }) => { const { province, isLoading, city } = geographic; return { @@ -18,7 +19,7 @@ const nullSlectItem = { isLoading, }; }) -export default class GeographicView extends PureComponent { +class GeographicView extends PureComponent { componentDidMount = () => { const { dispatch } = this.props; dispatch({ diff --git a/src/pages/Account/Settings/Info.js b/src/pages/Account/Settings/Info.js index 49fda8fe7b082d444ee7e790c553864cd2d639b1..ab7edaf9627aa6be44fc55f96ef7143ac0ed30e0 100644 --- a/src/pages/Account/Settings/Info.js +++ b/src/pages/Account/Settings/Info.js @@ -8,10 +8,11 @@ import styles from './Info.less'; const { Item } = Menu; +export default @connect(({ user }) => ({ currentUser: user.currentUser, })) -export default class Info extends Component { +class Info extends Component { constructor(props) { super(props); const { match, location } = props; diff --git a/src/pages/Dashboard/Monitor.js b/src/pages/Dashboard/Monitor.js index 71fc638465abe7c176d02cd014c2eb1e6878f7a1..5ec0a260bf51f7f37c28725ddddb0eb9b8a217d5 100644 --- a/src/pages/Dashboard/Monitor.js +++ b/src/pages/Dashboard/Monitor.js @@ -20,12 +20,14 @@ const havePermissionAsync = new Promise(resolve => { // Call resolve on behalf of passed setTimeout(() => resolve(), 300); }); + +export default @Secured(havePermissionAsync) @connect(({ monitor, loading }) => ({ monitor, loading: loading.models.monitor, })) -export default class Monitor extends PureComponent { +class Monitor extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ diff --git a/src/pages/Dashboard/Workplace.js b/src/pages/Dashboard/Workplace.js index 8826bb3ff83b473e063772e7abf99565f44397ea..c53ef469763426cf6470ece1d239024ae1edb3b1 100644 --- a/src/pages/Dashboard/Workplace.js +++ b/src/pages/Dashboard/Workplace.js @@ -37,6 +37,7 @@ const links = [ }, ]; +export default @connect(({ user, project, activities, chart, loading }) => ({ currentUser: user.currentUser, project, @@ -46,7 +47,7 @@ const links = [ projectLoading: loading.effects['project/fetchNotice'], activitiesLoading: loading.effects['activities/fetchList'], })) -export default class Workplace extends PureComponent { +class Workplace extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ diff --git a/src/pages/Exception/triggerException.js b/src/pages/Exception/triggerException.js index 3daab286cf65a0b29dcba2ef43749bb93e5d315d..1f561ee630a61cfe798b73867775077b08ea3421 100644 --- a/src/pages/Exception/triggerException.js +++ b/src/pages/Exception/triggerException.js @@ -3,10 +3,11 @@ import { Button, Spin, Card } from 'antd'; import { connect } from 'dva'; import styles from './style.less'; +export default @connect(state => ({ isloading: state.error.isloading, })) -export default class TriggerException extends PureComponent { +class TriggerException extends PureComponent { state = { isloading: false, }; diff --git a/src/pages/Forms/AdvancedForm.js b/src/pages/Forms/AdvancedForm.js index 595d522260a0d4fee8024ba5b11a6eb193914e27..a78afed80857d16130a60be533bd7e013ea36af0 100644 --- a/src/pages/Forms/AdvancedForm.js +++ b/src/pages/Forms/AdvancedForm.js @@ -57,11 +57,12 @@ const tableData = [ }, ]; +export default @connect(({ loading }) => ({ submitting: loading.effects['form/submitAdvancedForm'], })) @Form.create() -export default class AdvancedForm extends PureComponent { +class AdvancedForm extends PureComponent { state = { width: '100%', }; diff --git a/src/pages/Forms/BasicForm.js b/src/pages/Forms/BasicForm.js index 9c851533ebcccf46653fa881703205d6373366cf..9040ccea445be9a192c578e14596354cf41392b0 100644 --- a/src/pages/Forms/BasicForm.js +++ b/src/pages/Forms/BasicForm.js @@ -20,11 +20,12 @@ const { Option } = Select; const { RangePicker } = DatePicker; const { TextArea } = Input; +export default @connect(({ loading }) => ({ submitting: loading.effects['form/submitRegularForm'], })) @Form.create() -export default class BasicForms extends PureComponent { +class BasicForms extends PureComponent { handleSubmit = e => { const { dispatch, form } = this.props; e.preventDefault(); diff --git a/src/pages/Forms/StepForm/Step1.js b/src/pages/Forms/StepForm/Step1.js index 07c3b02ea6f2866bec415af3c0c863e9f92bf740..1be5d66123cb88403a7d4836c27b6b089026ebb8 100644 --- a/src/pages/Forms/StepForm/Step1.js +++ b/src/pages/Forms/StepForm/Step1.js @@ -15,11 +15,12 @@ const formItemLayout = { }, }; +export default @connect(({ form }) => ({ data: form.step, })) @Form.create() -export default class Step1 extends React.PureComponent { +class Step1 extends React.PureComponent { render() { const { form, dispatch, data } = this.props; const { getFieldDecorator, validateFields } = form; diff --git a/src/pages/Forms/StepForm/Step3.js b/src/pages/Forms/StepForm/Step3.js index 5273a5d5fbce835a7c51d8811e78a41b566e6659..4004c3990fa2472daedc976ebacf40135754d2ba 100644 --- a/src/pages/Forms/StepForm/Step3.js +++ b/src/pages/Forms/StepForm/Step3.js @@ -5,10 +5,11 @@ import router from 'umi/router'; import Result from '@/components/Result'; import styles from './style.less'; +export default @connect(({ form }) => ({ data: form.step, })) -export default class Step3 extends React.PureComponent { +class Step3 extends React.PureComponent { render() { const { data } = this.props; const onFinish = () => { diff --git a/src/pages/List/Applications.js b/src/pages/List/Applications.js index 9bf1e42c8bb1366743afb26db1cdd791c1a4d106..4d0871fee86da0dd7caa7108b8c7d3b1612a8df4 100644 --- a/src/pages/List/Applications.js +++ b/src/pages/List/Applications.js @@ -12,12 +12,13 @@ import styles from './Applications.less'; const { Option } = Select; const FormItem = Form.Item; +export default @Form.create() @connect(({ list, loading }) => ({ list, loading: loading.models.list, })) -export default class FilterCardList extends PureComponent { +class FilterCardList extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ diff --git a/src/pages/List/Articles.js b/src/pages/List/Articles.js index 9e90d02b409daeb5433a084ae8dc9ee60a9c4c40..a9a8c0f56b0e01e5b400f5b2c32425d6c01cf3ad 100644 --- a/src/pages/List/Articles.js +++ b/src/pages/List/Articles.js @@ -12,12 +12,13 @@ const FormItem = Form.Item; const pageSize = 5; +export default @Form.create() @connect(({ list, loading }) => ({ list, loading: loading.models.list, })) -export default class SearchList extends Component { +class SearchList extends Component { componentDidMount() { this.fetchMore(); } diff --git a/src/pages/List/BasicList.js b/src/pages/List/BasicList.js index 9618db8100272e44cf04e072ac9d1d4795033264..9e4e3ee2dfd47fe54445132c78be42754e5710ad 100644 --- a/src/pages/List/BasicList.js +++ b/src/pages/List/BasicList.js @@ -32,12 +32,13 @@ const RadioGroup = Radio.Group; const SelectOption = Select.Option; const { Search, TextArea } = Input; +export default @connect(({ list, loading }) => ({ list, loading: loading.models.list, })) @Form.create() -export default class BasicList extends PureComponent { +class BasicList extends PureComponent { state = { visible: false, done: false }; formLayout = { diff --git a/src/pages/List/CardList.js b/src/pages/List/CardList.js index 72f14d3889c9eb1e02a067138a0b65e0d07c3a82..f7a04ebf983d905ad1c59b18cf8baf30d422924e 100644 --- a/src/pages/List/CardList.js +++ b/src/pages/List/CardList.js @@ -7,11 +7,12 @@ import PageHeaderWrapper from '@/components/PageHeaderWrapper'; import styles from './CardList.less'; +export default @connect(({ list, loading }) => ({ list, loading: loading.models.list, })) -export default class CardList extends PureComponent { +class CardList extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ diff --git a/src/pages/List/List.js b/src/pages/List/List.js index a747e5cb0b0de5f94af78f125fa9622b6f93637d..9662df0a5e6f7a6804f128df783b365212b84974 100644 --- a/src/pages/List/List.js +++ b/src/pages/List/List.js @@ -4,8 +4,9 @@ import { connect } from 'dva'; import { Input } from 'antd'; import PageHeaderWrapper from '@/components/PageHeaderWrapper'; +export default @connect() -export default class SearchList extends Component { +class SearchList extends Component { handleTabChange = key => { const { match } = this.props; switch (key) { diff --git a/src/pages/List/Projects.js b/src/pages/List/Projects.js index 1b04eb62c635400f6a72702219d46ad0f4bc600b..e36cbdc2cf463443b9d78ff17b9a71cfbf4b0ffc 100644 --- a/src/pages/List/Projects.js +++ b/src/pages/List/Projects.js @@ -14,12 +14,13 @@ const { Option } = Select; const FormItem = Form.Item; /* eslint react/no-array-index-key: 0 */ +export default @Form.create() @connect(({ list, loading }) => ({ list, loading: loading.models.list, })) -export default class CoverCardList extends PureComponent { +class CoverCardList extends PureComponent { componentDidMount() { const { dispatch } = this.props; dispatch({ diff --git a/src/pages/List/TableList.js b/src/pages/List/TableList.js index a5465d05925bd48031d90034a020a71643591871..7e4d985ddd4e0a2c20795f31e8b7da5e7a9dc188 100644 --- a/src/pages/List/TableList.js +++ b/src/pages/List/TableList.js @@ -266,12 +266,13 @@ class UpdateForm extends PureComponent { } /* eslint react/no-multi-comp:0 */ +export default @connect(({ rule, loading }) => ({ rule, loading: loading.models.rule, })) @Form.create() -export default class TableList extends PureComponent { +class TableList extends PureComponent { state = { modalVisible: false, updateModalVisible: false, diff --git a/src/pages/Profile/AdvancedProfile.js b/src/pages/Profile/AdvancedProfile.js index 711d2f4d2ac31a3849afce5b7cec45b2cc5e4331..4ee9af2e8e22c85558889980e465c0f43162e98d 100644 --- a/src/pages/Profile/AdvancedProfile.js +++ b/src/pages/Profile/AdvancedProfile.js @@ -180,11 +180,12 @@ const columns = [ }, ]; +export default @connect(({ profile, loading }) => ({ profile, loading: loading.effects['profile/fetchAdvanced'], })) -export default class AdvancedProfile extends Component { +class AdvancedProfile extends Component { state = { operationkey: 'tab1', stepDirection: 'horizontal', diff --git a/src/pages/Profile/BasicProfile.js b/src/pages/Profile/BasicProfile.js index ff2c7bc10d9953b9fa8f9ff84ca0376b8340118f..fa34203165bf79a66dedee5cd7db804190815e1e 100644 --- a/src/pages/Profile/BasicProfile.js +++ b/src/pages/Profile/BasicProfile.js @@ -41,11 +41,12 @@ const progressColumns = [ }, ]; +export default @connect(({ profile, loading }) => ({ profile, loading: loading.effects['profile/fetchBasic'], })) -export default class BasicProfile extends Component { +class BasicProfile extends Component { componentDidMount() { const { dispatch } = this.props; dispatch({ diff --git a/src/pages/User/Login.js b/src/pages/User/Login.js index e0c9c1e83c106e0065d4eed013bdbd199f6eb086..4be606768493174dbecd5812ad1720e63674f239 100644 --- a/src/pages/User/Login.js +++ b/src/pages/User/Login.js @@ -7,11 +7,12 @@ import styles from './Login.less'; const { Tab, UserName, Password, Mobile, Captcha, Submit } = Login; +export default @connect(({ login, loading }) => ({ login, submitting: loading.effects['login/login'], })) -export default class LoginPage extends Component { +class LoginPage extends Component { state = { type: 'account', autoLogin: true, diff --git a/src/pages/User/Register.js b/src/pages/User/Register.js index 7ea4c60476fd74ae29b6d38d999790f5704d90a9..0c9aa0e3332968b0c0f8ee52736975111b5b657e 100644 --- a/src/pages/User/Register.js +++ b/src/pages/User/Register.js @@ -21,12 +21,13 @@ const passwordProgressMap = { poor: 'exception', }; +export default @connect(({ register, loading }) => ({ register, submitting: loading.effects['register/submit'], })) @Form.create() -export default class Register extends Component { +class Register extends Component { state = { count: 0, confirmDirty: false,