From 3ea5106733558f8115f3202c6eb2a296fdd90773 Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 29 Aug 2018 18:53:45 +0800 Subject: [PATCH] enable eslint import rules --- .eslintrc.js | 4 ++-- package.json | 11 +++++++--- src/components/Authorized/AuthorizedRoute.js | 23 ++++++++------------ src/layouts/BasicLayout.js | 2 +- src/pages/Forms/TableForm.js | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index faa6a366..273b854c 100755 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -15,8 +15,8 @@ module.exports = { 'react/prop-types': 0, 'react/forbid-prop-types': 0, 'react/jsx-one-expression-per-line': 0, - 'import/no-unresolved': 0, - 'import/no-extraneous-dependencies': 0, + 'import/no-unresolved': [2, { ignore: ['^@', '^umi/'] }], + 'import/no-extraneous-dependencies': [2, { optionalDependencies: true }], 'jsx-a11y/no-noninteractive-element-interactions': 0, 'jsx-a11y/click-events-have-key-events': 0, 'jsx-a11y/no-static-element-interactions': 0, diff --git a/package.json b/package.json index 83d09997..bbb44f36 100755 --- a/package.json +++ b/package.json @@ -29,9 +29,11 @@ "bizcharts": "^3.1.10", "bizcharts-plugin-slider": "^2.0.3", "classnames": "^2.2.6", + "dva": "^2.4.0", "enquire-js": "^0.2.1", + "hash.js": "^1.1.5", + "lodash": "^4.17.10", "lodash-decorators": "^6.0.0", - "lodash.isequal": "^4.5.0", "memoize-one": "^4.0.0", "moment": "^2.22.2", "numeral": "^2.0.6", @@ -39,11 +41,15 @@ "path-to-regexp": "^2.4.0", "prop-types": "^15.5.10", "qs": "^6.5.2", + "rc-animate": "^2.4.4", "react": "^16.4.1", "react-container-query": "^0.11.0", "react-copy-to-clipboard": "^5.0.1", "react-document-title": "^2.0.3", - "react-fittext": "^1.0.0" + "react-dom": "^16.4.2", + "react-fittext": "^1.0.0", + "react-router-dom": "^4.3.1", + "umi": "^2.0.0-beta.10" }, "devDependencies": { "@types/react": "^16.4.11", @@ -72,7 +78,6 @@ "stylelint": "^9.4.0", "stylelint-config-prettier": "^4.0.0", "stylelint-config-standard": "^18.0.0", - "umi": "^2.0.0-beta.10", "umi-plugin-react": "^1.0.0-beta.10" }, "optionalDependencies": { diff --git a/src/components/Authorized/AuthorizedRoute.js b/src/components/Authorized/AuthorizedRoute.js index 7534fabc..39c6a665 100644 --- a/src/components/Authorized/AuthorizedRoute.js +++ b/src/components/Authorized/AuthorizedRoute.js @@ -2,19 +2,14 @@ import React from 'react'; import { Route, Redirect } from 'react-router-dom'; import Authorized from './Authorized'; -class AuthorizedRoute extends React.Component { - render() { - // TODO: umi只会返回render和rest - const { component: Component, render, authority, redirectPath, ...rest } = this.props; - return ( - } />} - > - (Component ? : render(props))} /> - - ); - } -} +// TODO: umi只会返回render和rest +const AuthorizedRoute = ({ component: Component, render, authority, redirectPath, ...rest }) => ( + } />} + > + (Component ? : render(props))} /> + +); export default AuthorizedRoute; diff --git a/src/layouts/BasicLayout.js b/src/layouts/BasicLayout.js index e949f527..8f980016 100644 --- a/src/layouts/BasicLayout.js +++ b/src/layouts/BasicLayout.js @@ -1,7 +1,7 @@ import React from 'react'; import { Layout } from 'antd'; import DocumentTitle from 'react-document-title'; -import deepEqual from 'lodash.isequal'; +import deepEqual from 'lodash/isEqual'; import memoizeOne from 'memoize-one'; import { connect } from 'dva'; import { ContainerQuery } from 'react-container-query'; diff --git a/src/pages/Forms/TableForm.js b/src/pages/Forms/TableForm.js index dc590fc5..9bfd8acf 100644 --- a/src/pages/Forms/TableForm.js +++ b/src/pages/Forms/TableForm.js @@ -1,6 +1,6 @@ import React, { PureComponent, Fragment } from 'react'; import { Table, Button, Input, message, Popconfirm, Divider } from 'antd'; -import isEqual from 'lodash.isequal'; +import isEqual from 'lodash/isEqual'; import styles from './style.less'; export default class TableForm extends PureComponent { -- GitLab