From cdc57db28dc9401646bb05bce7ac840ed2649a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=B8=85?= Date: Thu, 18 Apr 2019 20:08:37 +0800 Subject: [PATCH] UserLogin finish --- .circleci/config.yml | 25 ------ AccountCenter/package.json | 4 +- AccountSettings/package.json | 2 +- AdvancedForm/package.json | 3 +- AdvancedProfile/package.json | 4 +- Analysis/package.json | 2 +- BasicForm/package.json | 5 +- BasicList/package.json | 2 +- BasicProfile/package.json | 2 +- CardList/package.json | 3 +- Monitor/package.json | 2 +- ResultFail/package.json | 3 +- SearchListApplications/package.json | 2 +- SearchListArticles/package.json | 2 +- SearchListProjects/package.json | 2 +- StepForm/package.json | 2 +- TableList/package.json | 2 +- UserLogin/package.json | 5 +- UserLogin/src/_mock.ts | 9 ++- UserLogin/src/components/Login/LoginItem.tsx | 10 +-- .../src/components/Login/LoginSubmit.tsx | 2 +- UserLogin/src/components/Login/LoginTab.tsx | 8 +- UserLogin/src/components/Login/index.tsx | 13 +-- UserLogin/src/index.tsx | 80 ++++++++++++++----- UserLogin/src/model.ts | 34 +++++++- UserLogin/src/service.ts | 5 +- UserRegister/package.json | 5 +- UserRegisterResult/package.json | 5 +- Workplace/package.json | 5 +- package.json | 39 ++++----- 30 files changed, 167 insertions(+), 120 deletions(-) delete mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e6c87e9a..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: circleci/node:latest - steps: - - checkout - - run: npm install - - run: npm run lint - - run: npm run build - test: - docker: - - image: circleci/node:latest-browsers - steps: - - checkout - - run: npm install - - run: - command: npm run test:all - no_output_timeout: 30m -workflows: - version: 2 - build_and_test: - jobs: - - build - - test diff --git a/AccountCenter/package.json b/AccountCenter/package.json index 6058ebff..e687973c 100644 --- a/AccountCenter/package.json +++ b/AccountCenter/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/accountcenter" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "react": "^16.6.3", "umi-request": "^1.0.0" @@ -22,4 +22,4 @@ "umi-plugin-block-dev": "^1.0.0" }, "license": "ISC" -} +} \ No newline at end of file diff --git a/AccountSettings/package.json b/AccountSettings/package.json index aa8984ad..298c2698 100644 --- a/AccountSettings/package.json +++ b/AccountSettings/package.json @@ -12,7 +12,7 @@ "dev": "umi dev" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "react": "^16.6.3", "umi-request": "^1.0.0" diff --git a/AdvancedForm/package.json b/AdvancedForm/package.json index f9433b1b..39b5c017 100644 --- a/AdvancedForm/package.json +++ b/AdvancedForm/package.json @@ -12,8 +12,7 @@ "dev": "umi dev" }, "dependencies": { - "ant-design-pro": "^2.1.1", - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "lodash": "^4.17.10", "react": "^16.6.3", diff --git a/AdvancedProfile/package.json b/AdvancedProfile/package.json index 386e0e13..43a044fc 100644 --- a/AdvancedProfile/package.json +++ b/AdvancedProfile/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/advancedprofile" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "classnames": "^2.2.6", "dva": "^2.4.0", "lodash-decorators": "^6.0.0", @@ -25,4 +25,4 @@ "umi-plugin-block-dev": "^1.0.0" }, "license": "ISC" -} +} \ No newline at end of file diff --git a/Analysis/package.json b/Analysis/package.json index 170d660d..3cc7f0b3 100644 --- a/Analysis/package.json +++ b/Analysis/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@antv/data-set": "^0.10.2", - "antd": "^3.10.9", + "antd": "^3.16.3", "bizcharts": "^3.5.2", "bizcharts-plugin-slider": "^2.1.1-beta.1", "dva": "^2.4.0", diff --git a/BasicForm/package.json b/BasicForm/package.json index 62a6f81d..9a880089 100644 --- a/BasicForm/package.json +++ b/BasicForm/package.json @@ -11,8 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/basicform" }, "dependencies": { - "ant-design-pro": "^2.1.1", - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "react": "^16.6.3", "umi-request": "^1.0.0", @@ -24,4 +23,4 @@ "umi-plugin-block-dev": "^1.0.0" }, "license": "ISC" -} +} \ No newline at end of file diff --git a/BasicList/package.json b/BasicList/package.json index 27957a83..bd684cdf 100644 --- a/BasicList/package.json +++ b/BasicList/package.json @@ -12,7 +12,7 @@ "dev": "umi dev" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "hash.js": "^1.1.5", "moment": "^2.22.2", diff --git a/BasicProfile/package.json b/BasicProfile/package.json index 9fc8477a..853d5343 100644 --- a/BasicProfile/package.json +++ b/BasicProfile/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/basicprofile" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "react": "^16.6.3", "umi-request": "^1.0.0" diff --git a/CardList/package.json b/CardList/package.json index 4fc5e6b0..2106ac91 100644 --- a/CardList/package.json +++ b/CardList/package.json @@ -11,8 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/cardlist" }, "dependencies": { - "ant-design-pro": "^2.1.1", - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "react": "^16.6.3", "umi-request": "^1.0.0" diff --git a/Monitor/package.json b/Monitor/package.json index 2af3f5f5..0c003220 100644 --- a/Monitor/package.json +++ b/Monitor/package.json @@ -12,7 +12,7 @@ }, "dependencies": { "@antv/data-set": "^0.10.2", - "antd": "^3.10.9", + "antd": "^3.16.3", "bizcharts": "^3.5.2", "bizcharts-plugin-slider": "^2.1.1-beta.1", "dva": "^2.4.0", diff --git a/ResultFail/package.json b/ResultFail/package.json index 7c448286..601520e6 100644 --- a/ResultFail/package.json +++ b/ResultFail/package.json @@ -12,8 +12,7 @@ }, "dependencies": { "react": "^16.6.3", - "antd": "^3.10.9", - "ant-design-pro": "^2.1.1" + "antd": "^3.16.3" }, "devDependencies": { "umi": "^2.6.9", diff --git a/SearchListApplications/package.json b/SearchListApplications/package.json index 8dd5dcd8..03aa7ffe 100644 --- a/SearchListApplications/package.json +++ b/SearchListApplications/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistapplications" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "classnames": "^2.2.6", "dva": "^2.4.0", "hash.js": "^1.1.5", diff --git a/SearchListArticles/package.json b/SearchListArticles/package.json index 9fb68ae5..55ba68c3 100644 --- a/SearchListArticles/package.json +++ b/SearchListArticles/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistarticles" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "classnames": "^2.2.6", "dva": "^2.4.0", "moment": "^2.22.2", diff --git a/SearchListProjects/package.json b/SearchListProjects/package.json index 85dda4f6..8869ff24 100644 --- a/SearchListProjects/package.json +++ b/SearchListProjects/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/searchlistprojects" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "classnames": "^2.2.6", "dva": "^2.4.0", "moment": "^2.22.2", diff --git a/StepForm/package.json b/StepForm/package.json index 58301d18..2f3caad5 100644 --- a/StepForm/package.json +++ b/StepForm/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/stepform" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "react": "^16.6.3", "umi-request": "^1.0.0", diff --git a/TableList/package.json b/TableList/package.json index 0c6f62c2..f661a0ec 100644 --- a/TableList/package.json +++ b/TableList/package.json @@ -11,7 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/tablelist" }, "dependencies": { - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "moment": "^2.22.2", "react": "^16.6.3", diff --git a/UserLogin/package.json b/UserLogin/package.json index e41e85c5..098c6f58 100644 --- a/UserLogin/package.json +++ b/UserLogin/package.json @@ -11,8 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/userlogin" }, "dependencies": { - "ant-design-pro": "^2.1.1", - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "moment": "^2.22.2", "query-string": "^6.0.0", @@ -25,4 +24,4 @@ "umi-plugin-react": "^1.3.0-beta.1" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/UserLogin/src/_mock.ts b/UserLogin/src/_mock.ts index 362b027c..1bdba394 100644 --- a/UserLogin/src/_mock.ts +++ b/UserLogin/src/_mock.ts @@ -1,9 +1,14 @@ -function getFakeCaptcha(req, res) { +function getFakeCaptcha(req: any, res: { json: (arg0: string) => void }) { return res.json('captcha-xxx'); } export default { - 'POST /api/BLOCK_NAME/account': (req, res) => { + 'POST /api/BLOCK_NAME/account': ( + req: { body: { password: any; userName: any; type: any } }, + res: { + send: (data: any) => void; + } + ) => { const { password, userName, type } = req.body; if (password === 'ant.design' && userName === 'admin') { res.send({ diff --git a/UserLogin/src/components/Login/LoginItem.tsx b/UserLogin/src/components/Login/LoginItem.tsx index e3694eff..18a80e75 100644 --- a/UserLogin/src/components/Login/LoginItem.tsx +++ b/UserLogin/src/components/Login/LoginItem.tsx @@ -3,7 +3,7 @@ import { Form, Input, Button, Row, Col } from 'antd'; import omit from 'omit.js'; import styles from './index.less'; import ItemMap from './map'; -import LoginContext, { ILoginContext } from './loginContext'; +import LoginContext, { ILoginContext } from './LoginContext'; import { FormComponentProps } from 'antd/lib/form'; type Omit = Pick>; @@ -12,7 +12,7 @@ export type WrappedLoginItemProps = Omit }; -export interface LoginItemProps extends FormComponentProps { +export interface LoginItemProps { name?: string; rules?: any[]; style?: React.CSSProperties; @@ -23,9 +23,10 @@ export interface LoginItemProps extends FormComponentProps { countDown?: number; getCaptchaButtonText?: string; getCaptchaSecondText?: string; - updateActive: ILoginContext['updateActive']; - type: string; + updateActive?: ILoginContext['updateActive']; + type?: string; defaultValue?: string; + form?: FormComponentProps['form']; customProps?: { [key: string]: any }; onChange?: (e: any) => void; } @@ -124,7 +125,6 @@ class WrapFormItem extends Component { console.warn('name is required!'); return null; } - console.log(form); if (!form) { return null; } diff --git a/UserLogin/src/components/Login/LoginSubmit.tsx b/UserLogin/src/components/Login/LoginSubmit.tsx index 2a6c246c..ecac1c28 100644 --- a/UserLogin/src/components/Login/LoginSubmit.tsx +++ b/UserLogin/src/components/Login/LoginSubmit.tsx @@ -6,7 +6,7 @@ import { ButtonProps } from 'antd/lib/button'; const FormItem = Form.Item; interface LoginSubmitProps extends ButtonProps { - className: string; + className?: string; } const LoginSubmit: React.SFC = ({ className, ...rest }) => { diff --git a/UserLogin/src/components/Login/LoginTab.tsx b/UserLogin/src/components/Login/LoginTab.tsx index 90743f08..6620882c 100644 --- a/UserLogin/src/components/Login/LoginTab.tsx +++ b/UserLogin/src/components/Login/LoginTab.tsx @@ -34,13 +34,15 @@ class LoginTab extends Component { } } -const wrapContext = (props: TabPaneProps) => ( +const WrapContext: React.SFC & { + typeName: string; +} = props => ( {value => } ); // 标志位 用来判断是不是自定义组件 -wrapContext.typeName = 'LoginTab'; +WrapContext.typeName = 'LoginTab'; -export default wrapContext; +export default WrapContext; diff --git a/UserLogin/src/components/Login/index.tsx b/UserLogin/src/components/Login/index.tsx index 8ff29d16..289f2fbf 100644 --- a/UserLogin/src/components/Login/index.tsx +++ b/UserLogin/src/components/Login/index.tsx @@ -8,12 +8,13 @@ import LoginContext, { ILoginContext } from './LoginContext'; import { FormComponentProps } from 'antd/lib/form'; import LoginSubmit from './LoginSubmit'; -export interface LoginProps extends FormComponentProps { +export interface LoginProps { defaultActiveKey?: string; onTabChange?: (key: string) => void; style?: React.CSSProperties; onSubmit?: (error: any, values: any) => void; className?: string; + form?: FormComponentProps['form']; children: React.ReactElement[]; } @@ -96,9 +97,10 @@ class Login extends Component { const { active = {}, type = '' } = this.state; const { form, onSubmit } = this.props; const activeFields = active[type] || []; - form.validateFields(activeFields, { force: true }, (err, values) => { - onSubmit && onSubmit(err, values); - }); + form && + form.validateFields(activeFields, { force: true }, (err, values) => { + onSubmit && onSubmit(err, values); + }); }; render() { @@ -119,7 +121,6 @@ class Login extends Component { } } ); - console.log(this.getContext()); return (
@@ -149,4 +150,4 @@ class Login extends Component { Login[item] = LoginItem[item]; }); -export default Form.create()(Login); +export default (Form.create()(Login as any) as unknown) as typeof Login; diff --git a/UserLogin/src/index.tsx b/UserLogin/src/index.tsx index cfcc0b8e..c22c8e6b 100644 --- a/UserLogin/src/index.tsx +++ b/UserLogin/src/index.tsx @@ -5,40 +5,78 @@ import Link from 'umi/link'; import { Checkbox, Alert, Icon } from 'antd'; import Login from './components/Login'; import styles from './style.less'; +import { Dispatch } from 'redux'; +import { IStateType } from './model'; +import { FormComponentProps } from 'antd/lib/form'; +import { CheckboxChangeEvent } from 'antd/lib/checkbox'; const { Tab, UserName, Password, Mobile, Captcha, Submit } = Login; -@connect(({ BLOCK_NAME_CAMEL_CASE, loading }) => ({ - BLOCK_NAME_CAMEL_CASE, - submitting: loading.effects['BLOCK_NAME_CAMEL_CASE/login'], -})) -class LoginPage extends Component { - state = { +interface BLOCK_NAME_CAMEL_CASEProps { + dispatch: Dispatch; + BLOCK_NAME_CAMEL_CASE: IStateType; + submitting: boolean; +} +interface BLOCK_NAME_CAMEL_CASEState { + type: string; + autoLogin: boolean; +} +export interface FromDataType { + userName: string; + password: string; + mobile: string; + captcha: string; +} + +@connect( + ({ + BLOCK_NAME_CAMEL_CASE, + loading, + }: { + BLOCK_NAME_CAMEL_CASE: IStateType; + loading: { + effects: { + [key: string]: string; + }; + }; + }) => ({ + BLOCK_NAME_CAMEL_CASE, + submitting: loading.effects['BLOCK_NAME_CAMEL_CASE/login'], + }) +) +class BLOCK_NAME_CAMEL_CASE extends Component< + BLOCK_NAME_CAMEL_CASEProps, + BLOCK_NAME_CAMEL_CASEState +> { + state: BLOCK_NAME_CAMEL_CASEState = { type: 'account', autoLogin: true, }; - onTabChange = type => { + onTabChange = (type: string) => { this.setState({ type }); }; - loginForm: loginForm; + loginForm: FormComponentProps['form'] | undefined | null; onGetCaptcha = () => new Promise((resolve, reject) => { - this.loginForm.validateFields(['mobile'], {}, (err, values) => { + if (!this.loginForm) { + return; + } + this.loginForm.validateFields(['mobile'], {}, (err: any, values: FromDataType) => { if (err) { reject(err); } else { const { dispatch } = this.props; - dispatch({ + ((dispatch({ type: 'BLOCK_NAME_CAMEL_CASE/getCaptcha', payload: values.mobile, - }) + }) as unknown) as Promise) .then(resolve) .catch(reject); } }); }); - handleSubmit = (err, values) => { + handleSubmit = (err: any, values: FromDataType) => { const { type } = this.state; if (!err) { const { dispatch } = this.props; @@ -52,13 +90,13 @@ class LoginPage extends Component { } }; - changeAutoLogin = e => { + changeAutoLogin = (e: CheckboxChangeEvent) => { this.setState({ autoLogin: e.target.checked, }); }; - renderMessage = content => ( + renderMessage = (content: string) => ( ); @@ -72,7 +110,7 @@ class LoginPage extends Component { defaultActiveKey={type} onTabChange={this.onTabChange} onSubmit={this.handleSubmit} - ref={form => { + ref={(form: any) => { this.loginForm = form; }} > @@ -92,7 +130,7 @@ class LoginPage extends Component { message: formatMessage({ id: 'BLOCK_NAME.userName.required' }), }, ]} - />{' '} + /> this.loginForm.validateFields(this.handleSubmit)} + onPressEnter={() => + this.loginForm && this.loginForm.validateFields(this.handleSubmit) + } /> @@ -112,7 +152,7 @@ class LoginPage extends Component { this.renderMessage( formatMessage({ id: 'BLOCK_NAME.login.message-invalid-verification-code' }) )} - {/* */} + />
@@ -167,4 +207,4 @@ class LoginPage extends Component { } } -export default LoginPage; +export default BLOCK_NAME_CAMEL_CASE; diff --git a/UserLogin/src/model.ts b/UserLogin/src/model.ts index 80d73caa..60361f58 100644 --- a/UserLogin/src/model.ts +++ b/UserLogin/src/model.ts @@ -2,7 +2,34 @@ import { routerRedux } from 'dva/router'; import { getPageQuery } from './utils/utils'; import { fakeAccountLogin, getFakeCaptcha } from './service'; -export default { +import { Reducer } from 'redux'; +import { EffectsCommandMap } from 'dva'; +import { AnyAction } from 'redux'; + +export interface IStateType { + status?: 'ok' | 'error'; + type?: string; + currentAuthority?: 'user' | 'guest' | 'admin'; +} + +export type Effect = ( + action: AnyAction, + effects: EffectsCommandMap & { select: (func: (state: IStateType) => T) => T } +) => void; + +export interface ModelType { + namespace: string; + state: IStateType; + effects: { + login: Effect; + getCaptcha: Effect; + }; + reducers: { + changeLoginStatus: Reducer; + }; +} + +const Model: ModelType = { namespace: 'BLOCK_NAME_CAMEL_CASE', state: { @@ -20,7 +47,7 @@ export default { if (response.status === 'ok') { const urlParams = new URL(window.location.href); const params = getPageQuery(); - let { redirect } = params; + let { redirect } = params as { redirect: string }; if (redirect) { const redirectUrlParams = new URL(redirect); if (redirectUrlParams.origin === urlParams.origin) { @@ -44,7 +71,6 @@ export default { reducers: { changeLoginStatus(state, { payload }) { - setAuthority(payload.currentAuthority); return { ...state, status: payload.status, @@ -53,3 +79,5 @@ export default { }, }, }; + +export default Model; diff --git a/UserLogin/src/service.ts b/UserLogin/src/service.ts index 9e99a1b8..2943090d 100644 --- a/UserLogin/src/service.ts +++ b/UserLogin/src/service.ts @@ -1,12 +1,13 @@ import request from 'umi-request'; +import { FromDataType } from './index'; -export async function fakeAccountLogin(params) { +export async function fakeAccountLogin(params: FromDataType) { return request('/api/BLOCK_NAME/account', { method: 'POST', data: params, }); } -export async function getFakeCaptcha(mobile) { +export async function getFakeCaptcha(mobile: string) { return request(`/api/BLOCK_NAME/captcha?mobile=${mobile}`); } diff --git a/UserRegister/package.json b/UserRegister/package.json index ffc8f2d6..d00479f6 100644 --- a/UserRegister/package.json +++ b/UserRegister/package.json @@ -11,8 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/userregister" }, "dependencies": { - "ant-design-pro": "^2.1.1", - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "hash.js": "^1.1.5", "moment": "^2.22.2", @@ -26,4 +25,4 @@ "umi-plugin-block-dev": "^1.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/UserRegisterResult/package.json b/UserRegisterResult/package.json index add0eb1a..6872d14a 100644 --- a/UserRegisterResult/package.json +++ b/UserRegisterResult/package.json @@ -12,8 +12,7 @@ }, "dependencies": { "react": "^16.6.3", - "antd": "^3.10.9", - "ant-design-pro": "^2.1.1" + "antd": "^3.16.3" }, "devDependencies": { "umi": "^2.6.9", @@ -21,4 +20,4 @@ "umi-plugin-block-dev": "^1.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/Workplace/package.json b/Workplace/package.json index f8cb6302..ff500b4c 100644 --- a/Workplace/package.json +++ b/Workplace/package.json @@ -11,8 +11,7 @@ "url": "https://github.com/umijs/umi-blocks/ant-design-pro/workplace" }, "dependencies": { - "ant-design-pro": "^2.1.1", - "antd": "^3.10.9", + "antd": "^3.16.3", "dva": "^2.4.0", "moment": "^2.22.2", "prop-types": "^15.5.10", @@ -25,4 +24,4 @@ "umi-plugin-react": "^1.3.0-beta.1" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/package.json b/package.json index a40dfa05..c932f2d5 100644 --- a/package.json +++ b/package.json @@ -2,13 +2,32 @@ "private": true, "scripts": { "dev": "cross-env PAGES_PATH='UserLogin/src' umi dev", - "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", "lint-staged": "lint-staged", "lint-staged:js": "eslint --ext .js", + "lint:fix": "eslint --fix --ext .js src mock tests && npm run lint:style", + "lint:style": "stylelint \"src/**/*.less\" --syntax less", "prettier": "node ./_scripts/prettier.js" }, + "husky": { + "hooks": { + "pre-commit": "npm run lint-staged" + } + }, + "lint-staged": { + "**/*.less": "stylelint --syntax less", + "x/**/*.{js,jsx}": "npm run lint-staged:js", + "x/**/*.{js,ts,tsx,json,jsx,less}": [ + "node ./_scripts/lint-prettier.js", + "git add" + ] + }, + "dependencies": { + "cross-env": "^5.2.0" + }, + "peerDependencies": { + "antd": "^3.16.3" + }, "devDependencies": { "@types/classnames": "^2.2.7", "babel-eslint": "^10.0.1", @@ -32,21 +51,5 @@ "umi-plugin-block-dev": "^2.0.2", "umi-plugin-react": "^1.3.0-0", "umi-request": "^1.0.0" - }, - "lint-staged": { - "x/**/*.{js,ts,tsx,json,jsx,less}": [ - "node ./_scripts/lint-prettier.js", - "git add" - ], - "x/**/*.{js,jsx}": "npm run lint-staged:js", - "**/*.less": "stylelint --syntax less" - }, - "husky": { - "hooks": { - "pre-commit": "npm run lint-staged" - } - }, - "dependencies": { - "cross-env": "^5.2.0" } } \ No newline at end of file -- GitLab