From 2b01db7ad07e8370c3d170c02e55dc007a854d5f Mon Sep 17 00:00:00 2001 From: afc163 Date: Mon, 9 Oct 2017 14:59:51 +0800 Subject: [PATCH] upgrade eslint-config-airbnb --- .eslintrc | 5 ++ mock/api.js | 2 +- mock/rule.js | 8 +-- mock/utils.js | 2 +- package.json | 7 ++- src/common/nav.js | 2 +- src/components/Charts/Bar/index.js | 2 +- src/components/Charts/ChartCard/index.js | 8 ++- src/components/Charts/Gauge/index.js | 4 +- src/components/Charts/MiniBar/index.js | 2 +- src/components/Charts/NumberInfo/index.js | 12 ++-- src/components/Charts/Pie/index.js | 72 ++++++++++++----------- src/components/Charts/Radar/index.js | 48 +++++++-------- src/components/Countdown/index.js | 7 +-- src/components/EditableItem/index.js | 2 +- src/components/HeaderSearch/index.js | 2 +- src/components/PageHeader/index.js | 2 +- src/components/RadioText/index.js | 10 ++-- src/components/Result/demo/classic.md | 2 +- src/components/StandardFormRow/index.js | 8 ++- src/components/StandardTable/index.js | 5 +- src/components/TagCloud/index.js | 4 +- src/components/TagSelect/index.js | 38 ++++++------ src/e2e/login.e2e.js | 4 +- src/layouts/BasicLayout.js | 7 +-- src/models/activities.js | 2 +- src/models/chart.js | 4 +- src/models/global.js | 2 +- src/models/login.js | 2 +- src/models/monitor.js | 2 +- src/models/profile.js | 4 +- src/models/project.js | 2 +- src/models/register.js | 2 +- src/models/user.js | 4 +- src/routes/Dashboard/Analysis.js | 42 +++++++------ src/routes/Forms/BasicForm.js | 2 +- src/routes/Forms/StepForm/Step1.js | 2 +- src/routes/Forms/StepForm/index.js | 2 +- src/routes/List/BasicList.js | 2 +- src/routes/List/CardList.js | 3 +- src/routes/List/CoverCardList.js | 2 +- src/routes/List/FilterCardList.js | 2 +- src/routes/List/SearchList.js | 2 +- src/routes/List/TableList.js | 60 ++++++++++--------- src/routes/Result/Success.js | 2 +- src/routes/User/Login.js | 2 +- src/routes/User/Register.js | 12 ++-- 47 files changed, 220 insertions(+), 204 deletions(-) diff --git a/.eslintrc b/.eslintrc index 3bd5636c..941f666a 100755 --- a/.eslintrc +++ b/.eslintrc @@ -24,6 +24,8 @@ "no-use-before-define": [0], "jsx-a11y/no-static-element-interactions": [0], "jsx-a11y/no-noninteractive-element-interactions": [0], + "jsx-a11y/click-events-have-key-events": [0], + "jsx-a11y/anchor-is-valid": [0], "no-nested-ternary": [0], "arrow-body-style": [0], "import/extensions": [0], @@ -37,6 +39,9 @@ "exports": "always-multiline", "functions": "ignore" }], + "object-curly-newline": [0], + "function-paren-newline": [0], + "no-restricted-globals": [0], "require-yield": [1] }, "parserOptions": { diff --git a/mock/api.js b/mock/api.js index d652f5bd..75fb66ae 100644 --- a/mock/api.js +++ b/mock/api.js @@ -73,7 +73,7 @@ export function fakeList(count) { export function getFakeList(req, res, u) { let url = u; if (!url || Object.prototype.toString.call(url) !== '[object String]') { - url = req.url; + url = req.url; // eslint-disable-line } const params = getUrlParams(url); diff --git a/mock/rule.js b/mock/rule.js index 13a4f353..1c494ca3 100644 --- a/mock/rule.js +++ b/mock/rule.js @@ -22,7 +22,7 @@ for (let i = 0; i < 46; i += 1) { export function getRule(req, res, u) { let url = u; if (!url || Object.prototype.toString.call(url) !== '[object String]') { - url = req.url; + url = req.url; // eslint-disable-line } const params = getUrlParams(url); @@ -74,20 +74,18 @@ export function getRule(req, res, u) { export function postRule(req, res, u, b) { let url = u; if (!url || Object.prototype.toString.call(url) !== '[object String]') { - url = req.url; + url = req.url; // eslint-disable-line } const body = (b && b.body) || req.body; - const method = body.method; + const { method, no, description } = body; switch (method) { /* eslint no-case-declarations:0 */ case 'delete': - const no = body.no; tableListDataSource = tableListDataSource.filter(item => no.indexOf(item.no) === -1); break; case 'post': - const description = body.description; const i = Math.ceil(Math.random() * 10000); tableListDataSource.unshift({ key: i, diff --git a/mock/utils.js b/mock/utils.js index 229e69b8..8438a265 100644 --- a/mock/utils.js +++ b/mock/utils.js @@ -12,7 +12,7 @@ export function getUrlParams(url) { let queryString = url ? url.split('?')[1] : window.location.search.slice(1); const obj = {}; if (queryString) { - queryString = queryString.split('#')[0]; + queryString = queryString.split('#')[0]; // eslint-disable-line const arr = queryString.split('&'); for (let i = 0; i < arr.length; i += 1) { const a = arr[i].split('='); diff --git a/package.json b/package.json index 0643a0cd..5bdbed30 100755 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "site": "roadhog-api-doc static", "lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint": "eslint --ext .js src mock tests && npm run lint:style", + "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style", "test": "jest", "test:all": "node ./tests/run-tests.js" }, @@ -36,11 +37,11 @@ "babel-runtime": "^6.9.2", "cross-port-killer": "^1.0.1", "enzyme": "^2.9.1", - "eslint": "^3.0.0", - "eslint-config-airbnb": "^15.0.0", + "eslint": "^4.0.0", + "eslint-config-airbnb": "^16.0.0", "eslint-plugin-babel": "^4.0.0", "eslint-plugin-import": "^2.2.0", - "eslint-plugin-jsx-a11y": "^5.0.1", + "eslint-plugin-jsx-a11y": "^6.0.0", "eslint-plugin-markdown": "^1.0.0-beta.6", "eslint-plugin-react": "^7.0.1", "gh-pages": "^1.0.0", diff --git a/src/common/nav.js b/src/common/nav.js index 9605d415..743551d7 100644 --- a/src/common/nav.js +++ b/src/common/nav.js @@ -34,7 +34,7 @@ import RegisterResult from '../routes/User/RegisterResult'; const data = [{ component: BasicLayout, - name: '首页', // for breadcrumb + name: '首页', // for breadcrumb path: '', children: [{ name: 'Dashboard', diff --git a/src/components/Charts/Bar/index.js b/src/components/Charts/Bar/index.js index 89fe1ae7..eaa57739 100644 --- a/src/components/Charts/Bar/index.js +++ b/src/components/Charts/Bar/index.js @@ -34,7 +34,7 @@ class Bar extends PureComponent { // clean this.node.innerHTML = ''; - const Frame = G2.Frame; + const { Frame } = G2; const frame = new Frame(data); const chart = new G2.Chart({ diff --git a/src/components/Charts/ChartCard/index.js b/src/components/Charts/ChartCard/index.js index 40faf796..20adbb5e 100644 --- a/src/components/Charts/ChartCard/index.js +++ b/src/components/Charts/ChartCard/index.js @@ -23,9 +23,11 @@ const ChartCard = ({ contentHeight, title, action, total, footer, children, ...r { - footer &&
- {footer} -
+ footer && ( +
+ {footer} +
+ ) } diff --git a/src/components/Charts/Gauge/index.js b/src/components/Charts/Gauge/index.js index d89543eb..7766c761 100644 --- a/src/components/Charts/Gauge/index.js +++ b/src/components/Charts/Gauge/index.js @@ -2,7 +2,7 @@ import React, { PureComponent } from 'react'; import G2 from 'g2'; import equal from '../equal'; -const Shape = G2.Shape; +const { Shape } = G2; /* eslint no-underscore-dangle: 0 */ class Gauge extends PureComponent { @@ -75,7 +75,7 @@ class Gauge extends PureComponent { }, }); - const origin = cfg.origin; + const { origin } = cfg; group.addShape('text', { attrs: { x: center.x, diff --git a/src/components/Charts/MiniBar/index.js b/src/components/Charts/MiniBar/index.js index a3f32b20..7153cf3c 100644 --- a/src/components/Charts/MiniBar/index.js +++ b/src/components/Charts/MiniBar/index.js @@ -34,7 +34,7 @@ class MiniBar extends PureComponent { // clean this.node.innerHTML = ''; - const Frame = G2.Frame; + const { Frame } = G2; const frame = new Frame(data); const chart = new G2.Chart({ diff --git a/src/components/Charts/NumberInfo/index.js b/src/components/Charts/NumberInfo/index.js index 4971f998..473796b2 100644 --- a/src/components/Charts/NumberInfo/index.js +++ b/src/components/Charts/NumberInfo/index.js @@ -20,12 +20,12 @@ export default ({ theme, title, subTitle, total, subTotal, status, ...rest }) =>
{total} { - (status || subTotal) && - { - status && - } - {subTotal} - + (status || subTotal) && ( + + {status && } + {subTotal} + + ) }
diff --git a/src/components/Charts/Pie/index.js b/src/components/Charts/Pie/index.js index fb83f952..5d068caa 100644 --- a/src/components/Charts/Pie/index.js +++ b/src/components/Charts/Pie/index.js @@ -38,7 +38,7 @@ class Pie extends Component { const newItem = item; newItem.checked = !newItem.checked; - const legendData = this.state.legendData; + const { legendData } = this.state; legendData[i] = newItem; if (this.chart) { @@ -59,7 +59,7 @@ class Pie extends Component { margin, percent, color, inner = 0.75, animate = true, - } = this.props; + } = this.props; let selected = this.props.selected || true; let tooltip = this.props.tooltips || true; @@ -109,7 +109,7 @@ class Pie extends Component { // clean this.node.innerHTML = ''; - const Stat = G2.Stat; + const { Stat } = G2; const chart = new G2.Chart({ container: this.node, @@ -189,39 +189,43 @@ class Pie extends Component {
{ - (subTitle || total) &&
- { - subTitle &&

{subTitle}

- } - { - // eslint-disable-next-line - total &&

- } -

+ (subTitle || total) && ( +
+ { + subTitle &&

{subTitle}

+ } + { + // eslint-disable-next-line + total &&

+ } +

+ ) } { - hasLegend &&
    - { - legendData.map((item, i) => ( -
  • this.handleLegendClick(item, i)}> - - {item.x} - - {`${(item['..percent'] * 100).toFixed(2)}%`} - -
  • - )) - } -
+ hasLegend && ( +
    + { + legendData.map((item, i) => ( +
  • this.handleLegendClick(item, i)}> + + {item.x} + + {`${(item['..percent'] * 100).toFixed(2)}%`} + +
  • + )) + } +
+ ) }
diff --git a/src/components/Charts/Radar/index.js b/src/components/Charts/Radar/index.js index f52d1947..244b2634 100644 --- a/src/components/Charts/Radar/index.js +++ b/src/components/Charts/Radar/index.js @@ -34,7 +34,7 @@ class Radar extends PureComponent { const newItem = item; newItem.checked = !newItem.checked; - const legendData = this.state.legendData; + const { legendData } = this.state; legendData[i] = newItem; if (this.chart) { @@ -130,28 +130,30 @@ class Radar extends PureComponent { { title &&

{title}

}
{ - hasLegend && - { - legendData.map((item, i) => ( - this.handleLegendClick(item, i)} - > -
-

- - {item.name} -

-
{item.value}
- { - i !== (legendData.length - 1) &&
- } -
- - )) - } - + hasLegend && ( + + { + legendData.map((item, i) => ( + this.handleLegendClick(item, i)} + > +
+

+ + {item.name} +

+
{item.value}
+ { + i !== (legendData.length - 1) &&
+ } +
+ + )) + } + + ) }
diff --git a/src/components/Countdown/index.js b/src/components/Countdown/index.js index 6b364a75..9a87949f 100644 --- a/src/components/Countdown/index.js +++ b/src/components/Countdown/index.js @@ -8,10 +8,9 @@ class Countdown extends Component { constructor(props) { super(props); - const { targetTime, lastTime } = this.initTime(props); + const { lastTime } = this.initTime(props); this.state = { - targetTime, lastTime, }; } @@ -22,10 +21,9 @@ class Countdown extends Component { componentWillReceiveProps(nextProps) { if (this.props.target !== nextProps.target) { - const { targetTime, lastTime } = this.initTime(nextProps); + const { lastTime } = this.initTime(nextProps); this.setState({ lastTime, - targetTime, }); } } @@ -53,7 +51,6 @@ class Countdown extends Component { return { lastTime, - targetTime, }; } // defaultFormat = time => ( diff --git a/src/components/EditableItem/index.js b/src/components/EditableItem/index.js index b5efcd8b..ea2f4477 100644 --- a/src/components/EditableItem/index.js +++ b/src/components/EditableItem/index.js @@ -8,7 +8,7 @@ export default class EditableItem extends PureComponent { editable: false, }; handleChange = (e) => { - const value = e.target.value; + const { value } = e.target; this.setState({ value }); } check = () => { diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index de6c44fd..f1ba25fd 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -17,7 +17,7 @@ export default class HeaderSearch extends PureComponent { onKeyDown = (e) => { if (e.key === 'Enter') { this.timeout = setTimeout(() => { - this.props.onPressEnter(this.state.value); // Fix duplicate onPressEnter + this.props.onPressEnter(this.state.value); // Fix duplicate onPressEnter }, 0); } } diff --git a/src/components/PageHeader/index.js b/src/components/PageHeader/index.js index 364b5562..01742a54 100644 --- a/src/components/PageHeader/index.js +++ b/src/components/PageHeader/index.js @@ -5,7 +5,7 @@ import { Link } from 'dva/router'; import classNames from 'classnames'; import styles from './index.less'; -const TabPane = Tabs.TabPane; +const { TabPane } = Tabs; function itemRender(route, params, routes, paths) { const last = routes.indexOf(route) === routes.length - 1; diff --git a/src/components/RadioText/index.js b/src/components/RadioText/index.js index 6d62dcdc..999e9ab1 100644 --- a/src/components/RadioText/index.js +++ b/src/components/RadioText/index.js @@ -3,8 +3,8 @@ import { Radio } from 'antd'; import styles from './index.less'; -const RadioButton = Radio.Button; - -export default props => (
- -
); +export default props => ( +
+ +
+); diff --git a/src/components/Result/demo/classic.md b/src/components/Result/demo/classic.md index 3b2ca727..9d371a2f 100644 --- a/src/components/Result/demo/classic.md +++ b/src/components/Result/demo/classic.md @@ -9,7 +9,7 @@ title: Classic import Result from 'ant-design-pro/lib/Result'; import { Button, Row, Col, Icon, Steps } from 'antd'; -const Step = Steps.Step; +const { Step } = Steps; const desc1 = (
diff --git a/src/components/StandardFormRow/index.js b/src/components/StandardFormRow/index.js index 27ecd79b..4ed6d9d9 100644 --- a/src/components/StandardFormRow/index.js +++ b/src/components/StandardFormRow/index.js @@ -12,9 +12,11 @@ export default ({ title, children, last, block, grid, ...rest }) => { return (
{ - title &&
- {title} -
+ title && ( +
+ {title} +
+ ) }
{children} diff --git a/src/components/StandardTable/index.js b/src/components/StandardTable/index.js index 4d6be6e8..ef855758 100644 --- a/src/components/StandardTable/index.js +++ b/src/components/StandardTable/index.js @@ -6,16 +6,13 @@ import styles from './index.less'; class StandardTable extends PureComponent { state = { selectedRowKeys: [], - selectedRows: [], totalCallNo: 0, - loading: false, }; componentWillReceiveProps(nextProps) { // clean state if (nextProps.selectedRows.length === 0) { this.setState({ - selectedRows: [], selectedRowKeys: [], totalCallNo: 0, }); @@ -31,7 +28,7 @@ class StandardTable extends PureComponent { this.props.onSelectRow(selectedRows); } - this.setState({ selectedRowKeys, selectedRows, totalCallNo }); + this.setState({ selectedRowKeys, totalCallNo }); } handleTableChange = (pagination, filters, sorter) => { diff --git a/src/components/TagCloud/index.js b/src/components/TagCloud/index.js index 72693b95..88a8d7bd 100644 --- a/src/components/TagCloud/index.js +++ b/src/components/TagCloud/index.js @@ -19,8 +19,7 @@ class TagCloud extends PureComponent { } initTagCloud = () => { - const Util = G2.Util; - const Shape = G2.Shape; + const { Util, Shape } = G2; function getTextAttrs(cfg) { const textAttrs = Util.mix(true, {}, { @@ -131,4 +130,3 @@ class TagCloud extends PureComponent { } export default TagCloud; - diff --git a/src/components/TagSelect/index.js b/src/components/TagSelect/index.js index e0969eba..74cf5ccf 100644 --- a/src/components/TagSelect/index.js +++ b/src/components/TagSelect/index.js @@ -4,7 +4,7 @@ import { Tag, Icon } from 'antd'; import styles from './index.less'; -const CheckableTag = Tag.CheckableTag; +const { CheckableTag } = Tag; const TagSelectOption = ({ children, checked, onChange, value }) => ( { const { onChange } = this.props; let checkedTags = []; - let expand = this.state.expand; + let expanded = this.state.expand; if (checked) { const tags = this.getAllTags(); checkedTags = tags.list; - expand = tags.expand; + expanded = tags.expand; } this.setState({ checkedAll: checked, checkedTags, - expand, + expand: expanded, }); if (onChange) { @@ -60,7 +60,7 @@ class TagSelect extends PureComponent { } getAllTags() { - let expand = this.state.expand; + let { expand } = this.state; const { children } = this.props; let checkedTags = children.filter(child => child.props.displayName === 'TagSelectOption').map(child => child.props.value); @@ -138,20 +138,24 @@ class TagSelect extends PureComponent { })) } { - expandNode && - { expand ? '收起' : '展开'} - + expandNode && ( + + { expand ? '收起' : '展开'} + + ) } { - expandNode &&
- { - expandNode.props.children.map(child => React.cloneElement(child, { - key: `tag-select-${child.props.value}`, - checked: checkedTags.indexOf(child.props.value) > -1, - onChange: this.handleTagChange, - })) - } -
+ expandNode && ( +
+ { + expandNode.props.children.map(child => React.cloneElement(child, { + key: `tag-select-${child.props.value}`, + checked: checkedTags.indexOf(child.props.value) > -1, + onChange: this.handleTagChange, + })) + } +
+ ) }
); diff --git a/src/e2e/login.e2e.js b/src/e2e/login.e2e.js index 8d565988..5e8e10a0 100644 --- a/src/e2e/login.e2e.js +++ b/src/e2e/login.e2e.js @@ -11,7 +11,7 @@ describe('Login', () => { await page.type('#userName', 'mockuser') .type('#password', 'wrong_password') .click('button[type="submit"]') - .wait('.ant-alert-error') // should display error + .wait('.ant-alert-error') // should display error .end(); }); @@ -19,7 +19,7 @@ describe('Login', () => { const text = await page.type('#userName', 'admin') .type('#password', '888888') .click('button[type="submit"]') - .wait('.ant-layout-sider h1') // should display error + .wait('.ant-layout-sider h1') // should display error .evaluate(() => document.body.innerHTML) .end(); expect(text).toContain('

Ant Design Pro

'); diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index 103c73bb..7a20b762 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -28,9 +28,6 @@ class BasicLayout extends React.PureComponent { openKeys: this.getDefaultCollapsedSubMenus(props), }; } - state = { - mode: 'inline', - }; getChildContext() { const { routes, params } = this.props; return { routes, params }; @@ -225,10 +222,10 @@ class BasicLayout extends React.PureComponent { placeholder="站内搜索" dataSource={['搜索提示一', '搜索提示二', '搜索提示三']} onSearch={(value) => { - console.log('input', value); // eslint-disable-line + console.log('input', value); // eslint-disable-line }} onPressEnter={(value) => { - console.log('enter', value); // eslint-disable-line + console.log('enter', value); // eslint-disable-line }} /> ); - const salesExtra = (
- ); + ); const columns = [ { @@ -233,10 +235,12 @@ export default class Analysis extends Component { title="线上购物转化率" action={} total="78%" - footer={ - 12.3% - 11% - } + footer={ + + 12.3% + 11% + + } contentHeight={46} > @@ -420,4 +424,4 @@ export default class Analysis extends Component {
); } - } +} diff --git a/src/routes/Forms/BasicForm.js b/src/routes/Forms/BasicForm.js index 34c44fcc..482f976d 100644 --- a/src/routes/Forms/BasicForm.js +++ b/src/routes/Forms/BasicForm.js @@ -4,7 +4,7 @@ import { Form, Input, DatePicker, Select, Button, Card } from 'antd'; import PageHeaderLayout from '../../layouts/PageHeaderLayout'; const FormItem = Form.Item; -const Option = Select.Option; +const { Option } = Select; const { RangePicker } = DatePicker; @connect(state => ({ diff --git a/src/routes/Forms/StepForm/Step1.js b/src/routes/Forms/StepForm/Step1.js index 7ae811b0..5e800307 100644 --- a/src/routes/Forms/StepForm/Step1.js +++ b/src/routes/Forms/StepForm/Step1.js @@ -3,7 +3,7 @@ import { Form, Input, Button, Select, Divider } from 'antd'; import { routerRedux } from 'dva/router'; import styles from './style.less'; -const Option = Select.Option; +const { Option } = Select; export default ({ formItemLayout, form, dispatch }) => { const { getFieldDecorator, validateFields } = form; diff --git a/src/routes/Forms/StepForm/index.js b/src/routes/Forms/StepForm/index.js index 85a0a20c..bca88bb0 100644 --- a/src/routes/Forms/StepForm/index.js +++ b/src/routes/Forms/StepForm/index.js @@ -5,7 +5,7 @@ import PageHeaderLayout from '../../../layouts/PageHeaderLayout'; import Step1 from './Step1'; import styles from '../style.less'; -const Step = Steps.Step; +const { Step } = Steps; @Form.create() class StepForm extends PureComponent { diff --git a/src/routes/List/BasicList.js b/src/routes/List/BasicList.js index 5dd0369c..c6f89a3a 100644 --- a/src/routes/List/BasicList.js +++ b/src/routes/List/BasicList.js @@ -9,7 +9,7 @@ import styles from './BasicList.less'; const RadioButton = Radio.Button; const RadioGroup = Radio.Group; -const Search = Input.Search; +const { Search } = Input; @connect(state => ({ list: state.list, diff --git a/src/routes/List/CardList.js b/src/routes/List/CardList.js index 9b7cda8b..b4a3681e 100644 --- a/src/routes/List/CardList.js +++ b/src/routes/List/CardList.js @@ -26,7 +26,8 @@ export default class CardList extends PureComponent { const content = (

段落示意:蚂蚁金服务设计平台-design.alipay.com,用最小的工作量,无缝接入蚂蚁金服生态, - 提供跨越设计与开发的体验解决方案。

+ 提供跨越设计与开发的体验解决方案。 +

快速开始 diff --git a/src/routes/List/CoverCardList.js b/src/routes/List/CoverCardList.js index 0fef6b31..06d3212b 100644 --- a/src/routes/List/CoverCardList.js +++ b/src/routes/List/CoverCardList.js @@ -12,7 +12,7 @@ import SearchInput from '../../components/SearchInput'; import styles from './CoverCardList.less'; -const Option = Select.Option; +const { Option } = Select; const FormItem = Form.Item; const TagOption = TagSelect.Option; const TagExpand = TagSelect.Expand; diff --git a/src/routes/List/FilterCardList.js b/src/routes/List/FilterCardList.js index 0b93c1e6..e7c6489b 100644 --- a/src/routes/List/FilterCardList.js +++ b/src/routes/List/FilterCardList.js @@ -11,7 +11,7 @@ import SearchInput from '../../components/SearchInput'; import styles from './FilterCardList.less'; -const Option = Select.Option; +const { Option } = Select; const FormItem = Form.Item; const TagOption = TagSelect.Option; const TagExpand = TagSelect.Expand; diff --git a/src/routes/List/SearchList.js b/src/routes/List/SearchList.js index d0974e3a..0b051bfe 100644 --- a/src/routes/List/SearchList.js +++ b/src/routes/List/SearchList.js @@ -10,7 +10,7 @@ import TagSelect from '../../components/TagSelect'; import SearchInput from '../../components/SearchInput'; import styles from './SearchList.less'; -const Option = Select.Option; +const { Option } = Select; const FormItem = Form.Item; const TagOption = TagSelect.Option; const TagExpand = TagSelect.Expand; diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js index 424e6e9d..042e65b6 100644 --- a/src/routes/List/TableList.js +++ b/src/routes/List/TableList.js @@ -7,7 +7,7 @@ import PageHeaderLayout from '../../layouts/PageHeaderLayout'; import styles from './TableList.less'; const FormItem = Form.Item; -const Option = Select.Option; +const { Option } = Select; const getValue = obj => Object.keys(obj).map(key => obj[key]).join(','); @connect(state => ({ @@ -203,39 +203,43 @@ export default class TableList extends PureComponent { { - this.state.expandForm && - - - {getFieldDecorator('updatedAt')( - - )} - - - - - {getFieldDecorator('callNo')( - } - placeholder="请输入" - /> - )} - - - + this.state.expandForm && ( + + + + {getFieldDecorator('updatedAt')( + + )} + + + + + {getFieldDecorator('callNo')( + } + placeholder="请输入" + /> + )} + + + + ) }
{ - selectedRows.length > 0 && - - - - - + selectedRows.length > 0 && ( + + + + + + + ) }
diff --git a/src/routes/User/Login.js b/src/routes/User/Login.js index 4db2e4a7..38665130 100644 --- a/src/routes/User/Login.js +++ b/src/routes/User/Login.js @@ -5,7 +5,7 @@ import { Form, Input, Tabs, Button, Icon, Checkbox, Row, Col, Alert } from 'antd import styles from './Login.less'; const FormItem = Form.Item; -const TabPane = Tabs.TabPane; +const { TabPane } = Tabs; @connect(state => ({ login: state.login, diff --git a/src/routes/User/Register.js b/src/routes/User/Register.js index 4bc444fc..58d60f1b 100644 --- a/src/routes/User/Register.js +++ b/src/routes/User/Register.js @@ -5,7 +5,7 @@ import { Form, Input, Button, Select, Row, Col, Popover, Progress } from 'antd'; import styles from './Register.less'; const FormItem = Form.Item; -const Option = Select.Option; +const { Option } = Select; const InputGroup = Input.Group; const passwordStatusMap = { @@ -55,7 +55,7 @@ export default class Register extends Component { } getPasswordStatus = () => { - const form = this.props.form; + const { form } = this.props; const value = form.getFieldValue('password'); if (value && value.length > 9) { return 'ok'; @@ -81,12 +81,12 @@ export default class Register extends Component { } handleConfirmBlur = (e) => { - const value = e.target.value; + const { value } = e.target; this.setState({ confirmDirty: this.state.confirmDirty || !!value }); } checkConfirm = (rule, value, callback) => { - const form = this.props.form; + const { form } = this.props; if (value && value !== form.getFieldValue('password')) { callback('两次输入的密码不匹配!'); } else { @@ -113,7 +113,7 @@ export default class Register extends Component { if (value.length < 6) { callback('error'); } else { - const form = this.props.form; + const { form } = this.props; if (value && this.state.confirmDirty) { form.validateFields(['confirm'], { force: true }); } @@ -123,7 +123,7 @@ export default class Register extends Component { } renderPasswordProgress = () => { - const form = this.props.form; + const { form } = this.props; const value = form.getFieldValue('password'); const passwordStatus = this.getPasswordStatus(); return value && value.length ? -- GitLab