Sfoglia il codice sorgente

➕ dependency: up prettier package.json (#6184)

陈帅 5 anni fa
parent
commit
6412fd6c35

+ 4 - 4
mock/listTableList.ts

@@ -57,7 +57,7 @@ function getRule(req: Request, res: Response, u: string) {
     let filterDataSource: TableListItem[] = [];
     let filterDataSource: TableListItem[] = [];
     status.forEach((s: string) => {
     status.forEach((s: string) => {
       filterDataSource = filterDataSource.concat(
       filterDataSource = filterDataSource.concat(
-        dataSource.filter(item => {
+        dataSource.filter((item) => {
           if (parseInt(`${item.status}`, 10) === parseInt(s.split('')[0], 10)) {
           if (parseInt(`${item.status}`, 10) === parseInt(s.split('')[0], 10)) {
             return true;
             return true;
           }
           }
@@ -69,7 +69,7 @@ function getRule(req: Request, res: Response, u: string) {
   }
   }
 
 
   if (params.name) {
   if (params.name) {
-    dataSource = dataSource.filter(data => data.name.includes(params.name || ''));
+    dataSource = dataSource.filter((data) => data.name.includes(params.name || ''));
   }
   }
   const result = {
   const result = {
     data: dataSource,
     data: dataSource,
@@ -94,7 +94,7 @@ function postRule(req: Request, res: Response, u: string, b: Request) {
   switch (method) {
   switch (method) {
     /* eslint no-case-declarations:0 */
     /* eslint no-case-declarations:0 */
     case 'delete':
     case 'delete':
-      tableListDataSource = tableListDataSource.filter(item => key.indexOf(item.key) === -1);
+      tableListDataSource = tableListDataSource.filter((item) => key.indexOf(item.key) === -1);
       break;
       break;
     case 'post':
     case 'post':
       (() => {
       (() => {
@@ -123,7 +123,7 @@ function postRule(req: Request, res: Response, u: string, b: Request) {
     case 'update':
     case 'update':
       (() => {
       (() => {
         let newRule = {};
         let newRule = {};
-        tableListDataSource = tableListDataSource.map(item => {
+        tableListDataSource = tableListDataSource.map((item) => {
           if (item.key === key) {
           if (item.key === key) {
             newRule = { ...item, desc, name };
             newRule = { ...item, desc, name };
             return { ...item, desc, name };
             return { ...item, desc, name };

+ 2 - 2
package.json

@@ -84,7 +84,7 @@
     "@types/react": "^16.9.17",
     "@types/react": "^16.9.17",
     "@types/react-dom": "^16.8.4",
     "@types/react-dom": "^16.8.4",
     "@types/react-helmet": "^5.0.13",
     "@types/react-helmet": "^5.0.13",
-    "@umijs/fabric": "^2.0.2",
+    "@umijs/fabric": "^2.0.5",
     "@umijs/plugin-blocks": "^2.0.5",
     "@umijs/plugin-blocks": "^2.0.5",
     "@umijs/preset-ant-design-pro": "^1.0.1",
     "@umijs/preset-ant-design-pro": "^1.0.1",
     "@umijs/preset-react": "^1.3.0",
     "@umijs/preset-react": "^1.3.0",
@@ -99,7 +99,7 @@
     "jsdom-global": "^3.0.2",
     "jsdom-global": "^3.0.2",
     "lint-staged": "^10.0.0",
     "lint-staged": "^10.0.0",
     "mockjs": "^1.0.1-beta3",
     "mockjs": "^1.0.1-beta3",
-    "prettier": "^1.19.1",
+    "prettier": "^2.0.1",
     "pro-download": "1.0.1",
     "pro-download": "1.0.1",
     "stylelint": "^13.0.0"
     "stylelint": "^13.0.0"
   },
   },

+ 2 - 2
src/components/Authorized/CheckPermissions.tsx

@@ -32,7 +32,7 @@ const checkPermissions = <T, K>(
   // 数组处理
   // 数组处理
   if (Array.isArray(authority)) {
   if (Array.isArray(authority)) {
     if (Array.isArray(currentAuthority)) {
     if (Array.isArray(currentAuthority)) {
-      if (currentAuthority.some(item => authority.includes(item))) {
+      if (currentAuthority.some((item) => authority.includes(item))) {
         return target;
         return target;
       }
       }
     } else if (authority.includes(currentAuthority)) {
     } else if (authority.includes(currentAuthority)) {
@@ -43,7 +43,7 @@ const checkPermissions = <T, K>(
   // string 处理
   // string 处理
   if (typeof authority === 'string') {
   if (typeof authority === 'string') {
     if (Array.isArray(currentAuthority)) {
     if (Array.isArray(currentAuthority)) {
-      if (currentAuthority.some(item => authority === item)) {
+      if (currentAuthority.some((item) => authority === item)) {
         return target;
         return target;
       }
       }
     } else if (authority === currentAuthority) {
     } else if (authority === currentAuthority) {

+ 4 - 4
src/components/GlobalHeader/NoticeIconView.tsx

@@ -61,7 +61,7 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
       return {};
       return {};
     }
     }
 
 
-    const newNotices = notices.map(notice => {
+    const newNotices = notices.map((notice) => {
       const newNotice = { ...notice };
       const newNotice = { ...notice };
 
 
       if (newNotice.datetime) {
       if (newNotice.datetime) {
@@ -100,7 +100,7 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
     const unreadMsg: {
     const unreadMsg: {
       [key: string]: number;
       [key: string]: number;
     } = {};
     } = {};
-    Object.keys(noticeData).forEach(key => {
+    Object.keys(noticeData).forEach((key) => {
       const value = noticeData[key];
       const value = noticeData[key];
 
 
       if (!unreadMsg[key]) {
       if (!unreadMsg[key]) {
@@ -108,7 +108,7 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
       }
       }
 
 
       if (Array.isArray(value)) {
       if (Array.isArray(value)) {
-        unreadMsg[key] = value.filter(item => !item.read).length;
+        unreadMsg[key] = value.filter((item) => !item.read).length;
       }
       }
     });
     });
     return unreadMsg;
     return unreadMsg;
@@ -122,7 +122,7 @@ class GlobalHeaderRight extends Component<GlobalHeaderRightProps> {
       <NoticeIcon
       <NoticeIcon
         className={styles.action}
         className={styles.action}
         count={currentUser && currentUser.unreadCount}
         count={currentUser && currentUser.unreadCount}
-        onItemClick={item => {
+        onItemClick={(item) => {
           this.changeReadState(item as NoticeItem);
           this.changeReadState(item as NoticeItem);
         }}
         }}
         loading={fetchingNotices}
         loading={fetchingNotices}

+ 1 - 1
src/components/GlobalHeader/RightContent.tsx

@@ -20,7 +20,7 @@ const ENVTagColor = {
   pre: '#87d068',
   pre: '#87d068',
 };
 };
 
 
-const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = props => {
+const GlobalHeaderRight: React.SFC<GlobalHeaderRightProps> = (props) => {
   const { theme, layout } = props;
   const { theme, layout } = props;
   let className = styles.right;
   let className = styles.right;
 
 

+ 2 - 2
src/components/HeaderSearch/index.tsx

@@ -20,7 +20,7 @@ export interface HeaderSearchProps {
   value?: string;
   value?: string;
 }
 }
 
 
-const HeaderSearch: React.FC<HeaderSearchProps> = props => {
+const HeaderSearch: React.FC<HeaderSearchProps> = (props) => {
   const {
   const {
     className,
     className,
     defaultValue,
     defaultValue,
@@ -86,7 +86,7 @@ const HeaderSearch: React.FC<HeaderSearchProps> = props => {
           defaultValue={defaultValue}
           defaultValue={defaultValue}
           aria-label={placeholder}
           aria-label={placeholder}
           placeholder={placeholder}
           placeholder={placeholder}
-          onKeyDown={e => {
+          onKeyDown={(e) => {
             if (e.key === 'Enter') {
             if (e.key === 'Enter') {
               if (restProps.onSearch) {
               if (restProps.onSearch) {
                 restProps.onSearch(value);
                 restProps.onSearch(value);

+ 1 - 1
src/components/NoticeIcon/NoticeList.tsx

@@ -97,7 +97,7 @@ const NoticeList: React.SFC<NoticeIconTabProps> = ({
         ) : null}
         ) : null}
         {showViewMore ? (
         {showViewMore ? (
           <div
           <div
-            onClick={e => {
+            onClick={(e) => {
               if (onViewMore) {
               if (onViewMore) {
                 onViewMore(e);
                 onViewMore(e);
               }
               }

+ 1 - 1
src/components/NoticeIcon/index.tsx

@@ -42,7 +42,7 @@ export interface NoticeIconProps {
 
 
 const NoticeIcon: React.FC<NoticeIconProps> & {
 const NoticeIcon: React.FC<NoticeIconProps> & {
   Tab: typeof NoticeList;
   Tab: typeof NoticeList;
-} = props => {
+} = (props) => {
   const getNotificationBox = (): React.ReactNode => {
   const getNotificationBox = (): React.ReactNode => {
     const {
     const {
       children,
       children,

+ 2 - 2
src/components/SelectLang/index.tsx

@@ -11,7 +11,7 @@ interface SelectLangProps {
   className?: string;
   className?: string;
 }
 }
 
 
-const SelectLang: React.FC<SelectLangProps> = props => {
+const SelectLang: React.FC<SelectLangProps> = (props) => {
   const { className } = props;
   const { className } = props;
   const selectedLang = getLocale();
   const selectedLang = getLocale();
 
 
@@ -32,7 +32,7 @@ const SelectLang: React.FC<SelectLangProps> = props => {
   };
   };
   const langMenu = (
   const langMenu = (
     <Menu className={styles.menu} selectedKeys={[selectedLang]} onClick={changeLang}>
     <Menu className={styles.menu} selectedKeys={[selectedLang]} onClick={changeLang}>
-      {locales.map(locale => (
+      {locales.map((locale) => (
         <Menu.Item key={locale}>
         <Menu.Item key={locale}>
           <span role="img" aria-label={languageLabels[locale]}>
           <span role="img" aria-label={languageLabels[locale]}>
             {languageIcons[locale]}
             {languageIcons[locale]}

+ 4 - 4
src/e2e/baseLayout.e2e.js

@@ -8,7 +8,7 @@ const getBrowser = require('./getBrowser');
 function formatter(routes, parentPath = '') {
 function formatter(routes, parentPath = '') {
   const fixedParentPath = parentPath.replace(/\/{1,}/g, '/');
   const fixedParentPath = parentPath.replace(/\/{1,}/g, '/');
   let result = [];
   let result = [];
-  routes.forEach(item => {
+  routes.forEach((item) => {
     if (item.path) {
     if (item.path) {
       result.push(`${fixedParentPath}/${item.path}`.replace(/\/{1,}/g, '/'));
       result.push(`${fixedParentPath}/${item.path}`.replace(/\/{1,}/g, '/'));
     }
     }
@@ -18,7 +18,7 @@ function formatter(routes, parentPath = '') {
       );
       );
     }
     }
   });
   });
-  return uniq(result.filter(item => !!item));
+  return uniq(result.filter((item) => !!item));
 }
 }
 
 
 let browser;
 let browser;
@@ -37,7 +37,7 @@ beforeEach(async () => {
 });
 });
 
 
 describe('Ant Design Pro E2E test', () => {
 describe('Ant Design Pro E2E test', () => {
-  const testPage = path => async () => {
+  const testPage = (path) => async () => {
     await page.goto(`${BASE_URL}${path}`);
     await page.goto(`${BASE_URL}${path}`);
     await page.waitForSelector('footer', {
     await page.waitForSelector('footer', {
       timeout: 2000,
       timeout: 2000,
@@ -49,7 +49,7 @@ describe('Ant Design Pro E2E test', () => {
   };
   };
 
 
   const routers = formatter(RouterConfig);
   const routers = formatter(RouterConfig);
-  routers.forEach(route => {
+  routers.forEach((route) => {
     it(`test pages ${route}`, testPage(route));
     it(`test pages ${route}`, testPage(route));
   });
   });
 });
 });

+ 6 - 6
src/global.tsx

@@ -25,7 +25,7 @@ if (pwa) {
       // Send skip-waiting event to waiting SW with MessageChannel
       // Send skip-waiting event to waiting SW with MessageChannel
       await new Promise((resolve, reject) => {
       await new Promise((resolve, reject) => {
         const channel = new MessageChannel();
         const channel = new MessageChannel();
-        channel.port1.onmessage = msgEvent => {
+        channel.port1.onmessage = (msgEvent) => {
           if (msgEvent.data.error) {
           if (msgEvent.data.error) {
             reject(msgEvent.data.error);
             reject(msgEvent.data.error);
           } else {
           } else {
@@ -62,20 +62,20 @@ if (pwa) {
   // unregister service worker
   // unregister service worker
   const { serviceWorker } = navigator;
   const { serviceWorker } = navigator;
   if (serviceWorker.getRegistrations) {
   if (serviceWorker.getRegistrations) {
-    serviceWorker.getRegistrations().then(sws => {
-      sws.forEach(sw => {
+    serviceWorker.getRegistrations().then((sws) => {
+      sws.forEach((sw) => {
         sw.unregister();
         sw.unregister();
       });
       });
     });
     });
   }
   }
-  serviceWorker.getRegistration().then(sw => {
+  serviceWorker.getRegistration().then((sw) => {
     if (sw) sw.unregister();
     if (sw) sw.unregister();
   });
   });
 
 
   // remove all caches
   // remove all caches
   if (window.caches && window.caches.keys) {
   if (window.caches && window.caches.keys) {
-    caches.keys().then(keys => {
-      keys.forEach(key => {
+    caches.keys().then((keys) => {
+      keys.forEach((key) => {
         caches.delete(key);
         caches.delete(key);
       });
       });
     });
     });

+ 2 - 2
src/layouts/BasicLayout.tsx

@@ -51,7 +51,7 @@ export type BasicLayoutContext = { [K in 'location']: BasicLayoutProps[K] } & {
  */
  */
 
 
 const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] =>
 const menuDataRender = (menuList: MenuDataItem[]): MenuDataItem[] =>
-  menuList.map(item => {
+  menuList.map((item) => {
     const localItem = { ...item, children: item.children ? menuDataRender(item.children) : [] };
     const localItem = { ...item, children: item.children ? menuDataRender(item.children) : [] };
     return Authorized.check(item.authority, localItem, null) as MenuDataItem;
     return Authorized.check(item.authority, localItem, null) as MenuDataItem;
   });
   });
@@ -82,7 +82,7 @@ const defaultFooterDom = (
   />
   />
 );
 );
 
 
-const BasicLayout: React.FC<BasicLayoutProps> = props => {
+const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
   const {
   const {
     dispatch,
     dispatch,
     children,
     children,

+ 1 - 1
src/layouts/UserLayout.tsx

@@ -13,7 +13,7 @@ export interface UserLayoutProps extends Partial<ConnectProps> {
   };
   };
 }
 }
 
 
-const UserLayout: React.FC<UserLayoutProps> = props => {
+const UserLayout: React.FC<UserLayoutProps> = (props) => {
   const {
   const {
     route = {
     route = {
       routes: [],
       routes: [],

+ 4 - 4
src/models/global.ts

@@ -47,7 +47,7 @@ const GlobalModel: GlobalModelType = {
         payload: data,
         payload: data,
       });
       });
       const unreadCount: number = yield select(
       const unreadCount: number = yield select(
-        (state: ConnectState) => state.global.notices.filter(item => !item.read).length,
+        (state: ConnectState) => state.global.notices.filter((item) => !item.read).length,
       );
       );
       yield put({
       yield put({
         type: 'user/changeNotifyCount',
         type: 'user/changeNotifyCount',
@@ -64,7 +64,7 @@ const GlobalModel: GlobalModelType = {
       });
       });
       const count: number = yield select((state: ConnectState) => state.global.notices.length);
       const count: number = yield select((state: ConnectState) => state.global.notices.length);
       const unreadCount: number = yield select(
       const unreadCount: number = yield select(
-        (state: ConnectState) => state.global.notices.filter(item => !item.read).length,
+        (state: ConnectState) => state.global.notices.filter((item) => !item.read).length,
       );
       );
       yield put({
       yield put({
         type: 'user/changeNotifyCount',
         type: 'user/changeNotifyCount',
@@ -76,7 +76,7 @@ const GlobalModel: GlobalModelType = {
     },
     },
     *changeNoticeReadState({ payload }, { put, select }) {
     *changeNoticeReadState({ payload }, { put, select }) {
       const notices: NoticeItem[] = yield select((state: ConnectState) =>
       const notices: NoticeItem[] = yield select((state: ConnectState) =>
-        state.global.notices.map(item => {
+        state.global.notices.map((item) => {
           const notice = { ...item };
           const notice = { ...item };
           if (notice.id === payload) {
           if (notice.id === payload) {
             notice.read = true;
             notice.read = true;
@@ -94,7 +94,7 @@ const GlobalModel: GlobalModelType = {
         type: 'user/changeNotifyCount',
         type: 'user/changeNotifyCount',
         payload: {
         payload: {
           totalCount: notices.length,
           totalCount: notices.length,
-          unreadCount: notices.filter(item => !item.read).length,
+          unreadCount: notices.filter((item) => !item.read).length,
         },
         },
       });
       });
     },
     },

+ 1 - 1
src/models/setting.ts

@@ -9,7 +9,7 @@ export interface SettingModelType {
   };
   };
 }
 }
 
 
-const updateColorWeak: (colorWeak: boolean) => void = colorWeak => {
+const updateColorWeak: (colorWeak: boolean) => void = (colorWeak) => {
   const root = document.getElementById('root');
   const root = document.getElementById('root');
   if (root) {
   if (root) {
     root.className = colorWeak ? 'colorWeak' : '';
     root.className = colorWeak ? 'colorWeak' : '';

+ 1 - 1
src/pages/ListTableList/components/CreateForm.tsx

@@ -6,7 +6,7 @@ interface CreateFormProps {
   onCancel: () => void;
   onCancel: () => void;
 }
 }
 
 
-const CreateForm: React.FC<CreateFormProps> = props => {
+const CreateForm: React.FC<CreateFormProps> = (props) => {
   const { modalVisible, onCancel } = props;
   const { modalVisible, onCancel } = props;
 
 
   return (
   return (

+ 1 - 1
src/pages/ListTableList/components/UpdateForm.tsx

@@ -33,7 +33,7 @@ const formLayout = {
   wrapperCol: { span: 13 },
   wrapperCol: { span: 13 },
 };
 };
 
 
-const UpdateForm: React.FC<UpdateFormProps> = props => {
+const UpdateForm: React.FC<UpdateFormProps> = (props) => {
   const [formVals, setFormVals] = useState<FormValueType>({
   const [formVals, setFormVals] = useState<FormValueType>({
     name: props.values.name,
     name: props.values.name,
     desc: props.values.desc,
     desc: props.values.desc,

+ 5 - 5
src/pages/ListTableList/index.tsx

@@ -60,7 +60,7 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
   if (!selectedRows) return true;
   if (!selectedRows) return true;
   try {
   try {
     await removeRule({
     await removeRule({
-      key: selectedRows.map(row => row.key),
+      key: selectedRows.map((row) => row.key),
     });
     });
     hide();
     hide();
     message.success('删除成功,即将刷新');
     message.success('删除成功,即将刷新');
@@ -163,7 +163,7 @@ const TableList: React.FC<{}> = () => {
             <Dropdown
             <Dropdown
               overlay={
               overlay={
                 <Menu
                 <Menu
-                  onClick={async e => {
+                  onClick={async (e) => {
                     if (e.key === 'remove') {
                     if (e.key === 'remove') {
                       await handleRemove(selectedRows);
                       await handleRemove(selectedRows);
                       action.reload();
                       action.reload();
@@ -190,13 +190,13 @@ const TableList: React.FC<{}> = () => {
             </span>
             </span>
           </div>
           </div>
         )}
         )}
-        request={params => queryRule(params)}
+        request={(params) => queryRule(params)}
         columns={columns}
         columns={columns}
         rowSelection={{}}
         rowSelection={{}}
       />
       />
       <CreateForm onCancel={() => handleModalVisible(false)} modalVisible={createModalVisible}>
       <CreateForm onCancel={() => handleModalVisible(false)} modalVisible={createModalVisible}>
         <ProTable<TableListItem, TableListItem>
         <ProTable<TableListItem, TableListItem>
-          onSubmit={async value => {
+          onSubmit={async (value) => {
             const success = await handleAdd(value);
             const success = await handleAdd(value);
             if (success) {
             if (success) {
               handleModalVisible(false);
               handleModalVisible(false);
@@ -213,7 +213,7 @@ const TableList: React.FC<{}> = () => {
       </CreateForm>
       </CreateForm>
       {stepFormValues && Object.keys(stepFormValues).length ? (
       {stepFormValues && Object.keys(stepFormValues).length ? (
         <UpdateForm
         <UpdateForm
-          onSubmit={async value => {
+          onSubmit={async (value) => {
             const success = await handleUpdate(value);
             const success = await handleUpdate(value);
             if (success) {
             if (success) {
               handleModalVisible(false);
               handleModalVisible(false);

+ 9 - 2
src/pages/document.ejs

@@ -182,7 +182,14 @@
         }
         }
       </style>
       </style>
       <div
       <div
-        style="display: flex;justify-content: center;align-items: center;flex-direction: column;min-height: 420px;height: 100%;"
+        style="
+          display: flex;
+          justify-content: center;
+          align-items: center;
+          flex-direction: column;
+          min-height: 420px;
+          height: 100%;
+        "
       >
       >
         <img src="/pro_icon.svg" alt="logo" width="256" />
         <img src="/pro_icon.svg" alt="logo" width="256" />
         <div class="page-loading-warp">
         <div class="page-loading-warp">
@@ -193,7 +200,7 @@
             ></span>
             ></span>
           </div>
           </div>
         </div>
         </div>
-        <div style="display: flex;justify-content: center;align-items: center;">
+        <div style="display: flex; justify-content: center; align-items: center;">
           <img
           <img
             src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
             src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg"
             width="32"
             width="32"

+ 4 - 4
src/pages/user/login/components/Login/LoginItem.tsx

@@ -57,7 +57,7 @@ const getFormItemOptions = ({
   return options;
   return options;
 };
 };
 
 
-const LoginItem: React.FC<LoginItemProps> = props => {
+const LoginItem: React.FC<LoginItemProps> = (props) => {
   const [count, setCount] = useState<number>(props.countDown || 0);
   const [count, setCount] = useState<number>(props.countDown || 0);
   const [timing, setTiming] = useState(false);
   const [timing, setTiming] = useState(false);
   // 这么写是为了防止restProps中 带入 onChange, defaultValue, rules props tabUtil
   // 这么写是为了防止restProps中 带入 onChange, defaultValue, rules props tabUtil
@@ -89,7 +89,7 @@ const LoginItem: React.FC<LoginItemProps> = props => {
     const { countDown } = props;
     const { countDown } = props;
     if (timing) {
     if (timing) {
       interval = window.setInterval(() => {
       interval = window.setInterval(() => {
-        setCount(preSecond => {
+        setCount((preSecond) => {
           if (preSecond <= 1) {
           if (preSecond <= 1) {
             setTiming(false);
             setTiming(false);
             clearInterval(interval);
             clearInterval(interval);
@@ -148,11 +148,11 @@ const LoginItem: React.FC<LoginItemProps> = props => {
 
 
 const LoginItems: Partial<LoginItemType> = {};
 const LoginItems: Partial<LoginItemType> = {};
 
 
-Object.keys(ItemMap).forEach(key => {
+Object.keys(ItemMap).forEach((key) => {
   const item = ItemMap[key];
   const item = ItemMap[key];
   LoginItems[key] = (props: LoginItemProps) => (
   LoginItems[key] = (props: LoginItemProps) => (
     <LoginContext.Consumer>
     <LoginContext.Consumer>
-      {context => (
+      {(context) => (
         <LoginItem
         <LoginItem
           customProps={item.props}
           customProps={item.props}
           rules={item.rules}
           rules={item.rules}

+ 3 - 3
src/pages/user/login/components/Login/LoginTab.tsx

@@ -18,7 +18,7 @@ interface LoginTabProps extends TabPaneProps {
   active?: boolean;
   active?: boolean;
 }
 }
 
 
-const LoginTab: React.FC<LoginTabProps> = props => {
+const LoginTab: React.FC<LoginTabProps> = (props) => {
   useEffect(() => {
   useEffect(() => {
     const uniqueId = generateId('login-tab-');
     const uniqueId = generateId('login-tab-');
     const { tabUtil } = props;
     const { tabUtil } = props;
@@ -32,9 +32,9 @@ const LoginTab: React.FC<LoginTabProps> = props => {
 
 
 const WrapContext: React.FC<TabPaneProps> & {
 const WrapContext: React.FC<TabPaneProps> & {
   typeName: string;
   typeName: string;
-} = props => (
+} = (props) => (
   <LoginContext.Consumer>
   <LoginContext.Consumer>
-    {value => <LoginTab tabUtil={value.tabUtil} {...props} />}
+    {(value) => <LoginTab tabUtil={value.tabUtil} {...props} />}
   </LoginContext.Consumer>
   </LoginContext.Consumer>
 );
 );
 
 

+ 7 - 7
src/pages/user/login/components/Login/index.tsx

@@ -30,7 +30,7 @@ interface LoginType extends React.FC<LoginProps> {
   Captcha: React.FunctionComponent<LoginItemProps>;
   Captcha: React.FunctionComponent<LoginItemProps>;
 }
 }
 
 
-const Login: LoginType = props => {
+const Login: LoginType = (props) => {
   const { className } = props;
   const { className } = props;
   const [tabs, setTabs] = useState<string[]>([]);
   const [tabs, setTabs] = useState<string[]>([]);
   const [active, setActive] = useState({});
   const [active, setActive] = useState({});
@@ -57,14 +57,14 @@ const Login: LoginType = props => {
     <LoginContext.Provider
     <LoginContext.Provider
       value={{
       value={{
         tabUtil: {
         tabUtil: {
-          addTab: id => {
+          addTab: (id) => {
             setTabs([...tabs, id]);
             setTabs([...tabs, id]);
           },
           },
-          removeTab: id => {
-            setTabs(tabs.filter(currentId => currentId !== id));
+          removeTab: (id) => {
+            setTabs(tabs.filter((currentId) => currentId !== id));
           },
           },
         },
         },
-        updateActive: activeItem => {
+        updateActive: (activeItem) => {
           if (!active) return;
           if (!active) return;
           if (active[type]) {
           if (active[type]) {
             active[type].push(activeItem);
             active[type].push(activeItem);
@@ -78,7 +78,7 @@ const Login: LoginType = props => {
       <div className={classNames(className, styles.login)}>
       <div className={classNames(className, styles.login)}>
         <Form
         <Form
           form={props.from}
           form={props.from}
-          onFinish={values => {
+          onFinish={(values) => {
             if (props.onSubmit) {
             if (props.onSubmit) {
               props.onSubmit(values as LoginParamsType);
               props.onSubmit(values as LoginParamsType);
             }
             }
@@ -90,7 +90,7 @@ const Login: LoginType = props => {
                 animated={false}
                 animated={false}
                 className={styles.tabs}
                 className={styles.tabs}
                 activeKey={type}
                 activeKey={type}
-                onChange={activeKey => {
+                onChange={(activeKey) => {
                   setType(activeKey);
                   setType(activeKey);
                 }}
                 }}
               >
               >

+ 2 - 2
src/pages/user/login/index.tsx

@@ -29,7 +29,7 @@ const LoginMessage: React.FC<{
   />
   />
 );
 );
 
 
-const Login: React.FC<LoginProps> = props => {
+const Login: React.FC<LoginProps> = (props) => {
   const { userLogin = {}, submitting } = props;
   const { userLogin = {}, submitting } = props;
   const { status, type: loginType } = userLogin;
   const { status, type: loginType } = userLogin;
   const [autoLogin, setAutoLogin] = useState(true);
   const [autoLogin, setAutoLogin] = useState(true);
@@ -104,7 +104,7 @@ const Login: React.FC<LoginProps> = props => {
           />
           />
         </Tab>
         </Tab>
         <div>
         <div>
-          <Checkbox checked={autoLogin} onChange={e => setAutoLogin(e.target.checked)}>
+          <Checkbox checked={autoLogin} onChange={(e) => setAutoLogin(e.target.checked)}>
             自动登录
             自动登录
           </Checkbox>
           </Checkbox>
           <a
           <a

+ 2 - 2
src/service-worker.js

@@ -50,7 +50,7 @@ workbox.routing.registerRoute(/\/color.less/, workbox.strategies.networkFirst())
 /**
 /**
  * Response to client after skipping waiting with MessageChannel
  * Response to client after skipping waiting with MessageChannel
  */
  */
-addEventListener('message', event => {
+addEventListener('message', (event) => {
   const replyPort = event.ports[0];
   const replyPort = event.ports[0];
   const message = event.data;
   const message = event.data;
   if (replyPort && message && message.type === 'skip-waiting') {
   if (replyPort && message && message.type === 'skip-waiting') {
@@ -60,7 +60,7 @@ addEventListener('message', event => {
           replyPort.postMessage({
           replyPort.postMessage({
             error: null,
             error: null,
           }),
           }),
-        error =>
+        (error) =>
           replyPort.postMessage({
           replyPort.postMessage({
             error,
             error,
           }),
           }),

+ 1 - 1
src/utils/utils.ts

@@ -45,7 +45,7 @@ export const getAuthorityFromRouter = <T extends Route>(
 
 
 export const getRouteAuthority = (path: string, routeData: Route[]) => {
 export const getRouteAuthority = (path: string, routeData: Route[]) => {
   let authorities: string[] | string | undefined;
   let authorities: string[] | string | undefined;
-  routeData.forEach(route => {
+  routeData.forEach((route) => {
     // match prefix
     // match prefix
     if (pathRegexp(`${route.path}/(.*)`).test(`${path}/`)) {
     if (pathRegexp(`${route.path}/(.*)`).test(`${path}/`)) {
       if (route.authority) {
       if (route.authority) {

+ 3 - 3
tests/run-tests.js

@@ -17,7 +17,7 @@ const startServer = spawn(/^win/.test(process.platform) ? 'npm.cmd' : 'npm', ['s
   env,
   env,
 });
 });
 
 
-startServer.stderr.on('data', data => {
+startServer.stderr.on('data', (data) => {
   // eslint-disable-next-line
   // eslint-disable-next-line
   console.log(data.toString());
   console.log(data.toString());
 });
 });
@@ -27,7 +27,7 @@ startServer.on('exit', () => {
 });
 });
 
 
 console.log('Starting development server for e2e tests...');
 console.log('Starting development server for e2e tests...');
-startServer.stdout.on('data', data => {
+startServer.stdout.on('data', (data) => {
   console.log(data.toString());
   console.log(data.toString());
   // hack code , wait umi
   // hack code , wait umi
   if (
   if (
@@ -44,7 +44,7 @@ startServer.stdout.on('data', data => {
         stdio: 'inherit',
         stdio: 'inherit',
       },
       },
     );
     );
-    testCmd.on('exit', code => {
+    testCmd.on('exit', (code) => {
       startServer.kill();
       startServer.kill();
       process.exit(code);
       process.exit(code);
     });
     });