Commit 3ea51067 authored by afc163's avatar afc163

enable eslint import rules

parent a0da5078
...@@ -15,8 +15,8 @@ module.exports = { ...@@ -15,8 +15,8 @@ module.exports = {
'react/prop-types': 0, 'react/prop-types': 0,
'react/forbid-prop-types': 0, 'react/forbid-prop-types': 0,
'react/jsx-one-expression-per-line': 0, 'react/jsx-one-expression-per-line': 0,
'import/no-unresolved': 0, 'import/no-unresolved': [2, { ignore: ['^@', '^umi/'] }],
'import/no-extraneous-dependencies': 0, 'import/no-extraneous-dependencies': [2, { optionalDependencies: true }],
'jsx-a11y/no-noninteractive-element-interactions': 0, 'jsx-a11y/no-noninteractive-element-interactions': 0,
'jsx-a11y/click-events-have-key-events': 0, 'jsx-a11y/click-events-have-key-events': 0,
'jsx-a11y/no-static-element-interactions': 0, 'jsx-a11y/no-static-element-interactions': 0,
......
...@@ -29,9 +29,11 @@ ...@@ -29,9 +29,11 @@
"bizcharts": "^3.1.10", "bizcharts": "^3.1.10",
"bizcharts-plugin-slider": "^2.0.3", "bizcharts-plugin-slider": "^2.0.3",
"classnames": "^2.2.6", "classnames": "^2.2.6",
"dva": "^2.4.0",
"enquire-js": "^0.2.1", "enquire-js": "^0.2.1",
"hash.js": "^1.1.5",
"lodash": "^4.17.10",
"lodash-decorators": "^6.0.0", "lodash-decorators": "^6.0.0",
"lodash.isequal": "^4.5.0",
"memoize-one": "^4.0.0", "memoize-one": "^4.0.0",
"moment": "^2.22.2", "moment": "^2.22.2",
"numeral": "^2.0.6", "numeral": "^2.0.6",
...@@ -39,11 +41,15 @@ ...@@ -39,11 +41,15 @@
"path-to-regexp": "^2.4.0", "path-to-regexp": "^2.4.0",
"prop-types": "^15.5.10", "prop-types": "^15.5.10",
"qs": "^6.5.2", "qs": "^6.5.2",
"rc-animate": "^2.4.4",
"react": "^16.4.1", "react": "^16.4.1",
"react-container-query": "^0.11.0", "react-container-query": "^0.11.0",
"react-copy-to-clipboard": "^5.0.1", "react-copy-to-clipboard": "^5.0.1",
"react-document-title": "^2.0.3", "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": { "devDependencies": {
"@types/react": "^16.4.11", "@types/react": "^16.4.11",
...@@ -72,7 +78,6 @@ ...@@ -72,7 +78,6 @@
"stylelint": "^9.4.0", "stylelint": "^9.4.0",
"stylelint-config-prettier": "^4.0.0", "stylelint-config-prettier": "^4.0.0",
"stylelint-config-standard": "^18.0.0", "stylelint-config-standard": "^18.0.0",
"umi": "^2.0.0-beta.10",
"umi-plugin-react": "^1.0.0-beta.10" "umi-plugin-react": "^1.0.0-beta.10"
}, },
"optionalDependencies": { "optionalDependencies": {
......
...@@ -2,19 +2,14 @@ import React from 'react'; ...@@ -2,19 +2,14 @@ import React from 'react';
import { Route, Redirect } from 'react-router-dom'; import { Route, Redirect } from 'react-router-dom';
import Authorized from './Authorized'; import Authorized from './Authorized';
class AuthorizedRoute extends React.Component { // TODO: umi只会返回render和rest
render() { const AuthorizedRoute = ({ component: Component, render, authority, redirectPath, ...rest }) => (
// TODO: umi只会返回render和rest <Authorized
const { component: Component, render, authority, redirectPath, ...rest } = this.props; authority={authority}
return ( noMatch={<Route {...rest} render={() => <Redirect to={{ pathname: redirectPath }} />} />}
<Authorized >
authority={authority} <Route {...rest} render={props => (Component ? <Component {...props} /> : render(props))} />
noMatch={<Route {...rest} render={() => <Redirect to={{ pathname: redirectPath }} />} />} </Authorized>
> );
<Route {...rest} render={props => (Component ? <Component {...props} /> : render(props))} />
</Authorized>
);
}
}
export default AuthorizedRoute; export default AuthorizedRoute;
import React from 'react'; import React from 'react';
import { Layout } from 'antd'; import { Layout } from 'antd';
import DocumentTitle from 'react-document-title'; import DocumentTitle from 'react-document-title';
import deepEqual from 'lodash.isequal'; import deepEqual from 'lodash/isEqual';
import memoizeOne from 'memoize-one'; import memoizeOne from 'memoize-one';
import { connect } from 'dva'; import { connect } from 'dva';
import { ContainerQuery } from 'react-container-query'; import { ContainerQuery } from 'react-container-query';
......
import React, { PureComponent, Fragment } from 'react'; import React, { PureComponent, Fragment } from 'react';
import { Table, Button, Input, message, Popconfirm, Divider } from 'antd'; import { Table, Button, Input, message, Popconfirm, Divider } from 'antd';
import isEqual from 'lodash.isequal'; import isEqual from 'lodash/isEqual';
import styles from './style.less'; import styles from './style.less';
export default class TableForm extends PureComponent { export default class TableForm extends PureComponent {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment