Browse Source

chore: fix biome lint errors

pull/11501/head
afc163 9 months ago
parent
commit
a25a0cf473
  1. 3
      biome.json
  2. 8
      package.json
  3. 2
      src/global.style.ts
  4. 6
      src/pages/account/center/_mock.ts
  5. 3
      src/pages/account/center/index.tsx
  6. 2
      src/pages/account/settings/_mock.ts
  7. 2
      src/pages/account/settings/components/base.tsx
  8. 4
      src/pages/account/settings/components/security.tsx
  9. 2
      src/pages/account/settings/index.tsx
  10. 4
      src/pages/dashboard/analysis/_mock.ts
  11. 17
      src/pages/dashboard/analysis/components/Charts/ChartCard/index.tsx
  12. 8
      src/pages/dashboard/analysis/components/Charts/WaterWave/index.tsx
  13. 2
      src/pages/dashboard/analysis/components/TopSearch.tsx
  14. 12
      src/pages/dashboard/analysis/index.tsx
  15. 10
      src/pages/dashboard/monitor/components/ActiveChart/index.tsx
  16. 8
      src/pages/dashboard/monitor/components/Charts/WaterWave/index.tsx
  17. 2
      src/pages/dashboard/monitor/components/Map/index.tsx
  18. 7
      src/pages/dashboard/monitor/index.tsx
  19. 4
      src/pages/dashboard/workplace/_mock.ts
  20. 4
      src/pages/form/advanced-form/components/TableForm.tsx
  21. 6
      src/pages/form/advanced-form/index.tsx
  22. 6
      src/pages/list/basic-list/_mock.ts
  23. 2
      src/pages/list/basic-list/components/OperationModal.tsx
  24. 4
      src/pages/list/card-list/_mock.ts
  25. 2
      src/pages/list/card-list/index.tsx
  26. 4
      src/pages/list/search/applications/_mock.ts
  27. 5
      src/pages/list/search/applications/components/TagSelect/index.tsx
  28. 15
      src/pages/list/search/applications/index.tsx
  29. 4
      src/pages/list/search/articles/_mock.ts
  30. 5
      src/pages/list/search/articles/components/TagSelect/index.tsx
  31. 17
      src/pages/list/search/articles/index.tsx
  32. 4
      src/pages/list/search/projects/_mock.ts
  33. 4
      src/pages/list/search/projects/components/AvatarList/index.tsx
  34. 5
      src/pages/list/search/projects/components/TagSelect/index.tsx
  35. 15
      src/pages/list/search/projects/index.tsx
  36. 4
      src/pages/list/table-list/_mock.ts
  37. 8
      src/pages/list/table-list/index.tsx
  38. 2
      src/pages/profile/advanced/_mock.ts
  39. 2
      src/pages/table-list/index.tsx
  40. 3
      src/pages/user/login/login.test.tsx
  41. 4
      src/pages/user/register/index.tsx

3
biome.json

@ -30,7 +30,8 @@
}, },
"a11y": { "a11y": {
"noStaticElementInteractions": "off", "noStaticElementInteractions": "off",
"useValidAnchor": "off" "useValidAnchor": "off",
"useKeyWithClickEvents": "off"
} }
} }
}, },

8
package.json

@ -43,7 +43,11 @@
"classnames": "^2.5.1", "classnames": "^2.5.1",
"dayjs": "^1.11.13", "dayjs": "^1.11.13",
"react": "^19.1.0", "react": "^19.1.0",
"react-dom": "^19.1.0" "react-dom": "^19.1.0",
"@ant-design/plots": "^2.6.0",
"@antv/l7-react": "^2.4.3",
"@antv/l7": "^2.22.7",
"numeral": "^2.0.6"
}, },
"devDependencies": { "devDependencies": {
"@ant-design/pro-cli": "^3.3.0", "@ant-design/pro-cli": "^3.3.0",
@ -104,4 +108,4 @@
"create-umi" "create-umi"
] ]
} }
} }

2
src/global.style.ts

@ -1,6 +1,6 @@
import { createStyles } from 'antd-style'; import { createStyles } from 'antd-style';
const useStyles = createStyles(({}) => { const useStyles = createStyles(() => {
return { return {
colorWeak: { colorWeak: {
filter: 'invert(80%)', filter: 'invert(80%)',

6
src/pages/account/center/_mock.ts

@ -180,8 +180,8 @@ function fakeList(count: number): ListItemDataType[] {
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
href: 'https://ant.design', href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), updatedAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), createdAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5], subDescription: desc[i % 5],
description: description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
@ -229,7 +229,7 @@ function getFakeList(req: Request, res: Response) {
} }
// 获取用户信息 // 获取用户信息
function getCurrentUser(req: Request, res: Response) { function getCurrentUser(_req: Request, res: Response) {
return res.json({ return res.json({
data: currentUseDetail, data: currentUseDetail,
}); });

3
src/pages/account/center/index.tsx

@ -223,8 +223,7 @@ const Center: React.FC = () => {
<div className={styles.team}> <div className={styles.team}>
<div className={styles.teamTitle}></div> <div className={styles.teamTitle}></div>
<Row gutter={36}> <Row gutter={36}>
{currentUser.notice && {currentUser.notice?.map((item) => (
currentUser.notice.map((item) => (
<Col key={item.id} lg={24} xl={12}> <Col key={item.id} lg={24} xl={12}>
<a href={item.href}> <a href={item.href}>
<Avatar size="small" src={item.logo} /> <Avatar size="small" src={item.logo} />

2
src/pages/account/settings/_mock.ts

@ -15,7 +15,7 @@ function getCity(req: Request, res: Response) {
}); });
} }
function getCurrentUse(req: Request, res: Response) { function getCurrentUse(_req: Request, res: Response) {
return res.json({ return res.json({
data: { data: {
name: 'Serati Ma', name: 'Serati Ma',

2
src/pages/account/settings/components/base.tsx

@ -13,7 +13,7 @@ import React from 'react';
import { queryCity, queryCurrent, queryProvince } from '../service'; import { queryCity, queryCurrent, queryProvince } from '../service';
import useStyles from './index.style'; import useStyles from './index.style';
const validatorPhone = (rule: any, value: string[], callback: (message?: string) => void) => { const validatorPhone = (_rule: any, value: string[], callback: (message?: string) => void) => {
if (!value[0]) { if (!value[0]) {
callback('Please input your area code!'); callback('Please input your area code!');
} }

4
src/pages/account/settings/components/security.tsx

@ -45,8 +45,7 @@ const SecurityView: React.FC = () => {
const data = getData(); const data = getData();
return ( return (
<> <List<Unpacked<typeof data>>
<List<Unpacked<typeof data>>
itemLayout="horizontal" itemLayout="horizontal"
dataSource={data} dataSource={data}
renderItem={(item) => ( renderItem={(item) => (
@ -55,7 +54,6 @@ const SecurityView: React.FC = () => {
</List.Item> </List.Item>
)} )}
/> />
</>
); );
}; };

2
src/pages/account/settings/index.tsx

@ -51,7 +51,7 @@ const Settings: React.FC = () => {
return () => { return () => {
window.removeEventListener('resize', resize); window.removeEventListener('resize', resize);
}; };
}, [dom.current]); }, [resize]);
const getMenu = () => { const getMenu = () => {
return Object.keys(menuMap).map((item) => ({ key: item, label: menuMap[item] })); return Object.keys(menuMap).map((item) => ({ key: item, label: menuMap[item] }));
}; };

4
src/pages/dashboard/analysis/_mock.ts

@ -4,7 +4,7 @@ import type { AnalysisData, DataItem, RadarData } from './data.d';
// mock data // mock data
const visitData: DataItem[] = []; const visitData: DataItem[] = [];
const beginDay = new Date().getTime(); const beginDay = Date.now();
const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5]; const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5];
for (let i = 0; i < fakeY.length; i += 1) { for (let i = 0; i < fakeY.length; i += 1) {
@ -126,7 +126,7 @@ for (let i = 0; i < 10; i += 1) {
} }
const offlineChartData = []; const offlineChartData = [];
for (let i = 0; i < 20; i += 1) { for (let i = 0; i < 20; i += 1) {
const date = dayjs(new Date().getTime() + 1000 * 60 * 30 * i).format('HH:mm'); const date = dayjs(Date.now()+ 1000 * 60 * 30 * i).format('HH:mm');
offlineChartData.push({ offlineChartData.push({
date, date,
type: '客流量', type: '客流量',

17
src/pages/dashboard/analysis/components/Charts/ChartCard/index.tsx

@ -22,7 +22,7 @@ const ChartCard: React.FC<ChartCardProps> = (props) => {
if (!total && total !== 0) { if (!total && total !== 0) {
return null; return null;
} }
let totalDom; let totalDom: React.ReactNode | null = null;
switch (typeof total) { switch (typeof total) {
case 'undefined': case 'undefined':
totalDom = null; totalDom = null;
@ -63,7 +63,7 @@ const ChartCard: React.FC<ChartCardProps> = (props) => {
height: contentHeight || 'auto', height: contentHeight || 'auto',
}} }}
> >
<div className={contentHeight && styles.contentFixed}>{children}</div> <div className={contentHeight ? styles.contentFixed : undefined}>{children}</div>
</div> </div>
)} )}
{footer && ( {footer && (
@ -81,20 +81,15 @@ const ChartCard: React.FC<ChartCardProps> = (props) => {
const { const {
loading = false, loading = false,
contentHeight,
title,
avatar,
action,
total,
footer,
children,
...rest ...rest
} = props; } = props;
return ( return (
<Card <Card
loading={loading} loading={loading}
bodyStyle={{ styles={{
padding: '20px 24px 8px 24px', body: {
padding: '20px 24px 8px 24px',
},
}} }}
{...rest} {...rest}
> >

8
src/pages/dashboard/analysis/components/Charts/WaterWave/index.tsx

@ -185,7 +185,9 @@ class WaterWave extends Component<WaterWaveProps> {
return ( return (
<div <div
className={styles.waterWave} className={styles.waterWave}
ref={(n) => (this.root = n)} ref={(n) => {
this.root = n;
}}
style={{ style={{
transform: `scale(${radio})`, transform: `scale(${radio})`,
}} }}
@ -199,7 +201,9 @@ class WaterWave extends Component<WaterWaveProps> {
> >
<canvas <canvas
className={styles.waterWaveCanvasWrapper} className={styles.waterWaveCanvasWrapper}
ref={(n) => (this.node = n)} ref={(n) => {
this.node = n;
}}
width={height * 2} width={height * 2}
height={height * 2} height={height * 2}
/> />

2
src/pages/dashboard/analysis/components/TopSearch.tsx

@ -4,7 +4,6 @@ import { Card, Col, Row, Table, Tooltip } from 'antd';
import numeral from 'numeral'; import numeral from 'numeral';
import React from 'react'; import React from 'react';
import type { DataItem } from '../data.d'; import type { DataItem } from '../data.d';
import useStyles from '../style.style';
import NumberInfo from './NumberInfo'; import NumberInfo from './NumberInfo';
import Trend from './Trend'; import Trend from './Trend';
@ -19,7 +18,6 @@ const TopSearch = ({
dropdownGroup: React.ReactNode; dropdownGroup: React.ReactNode;
searchData: DataItem[]; searchData: DataItem[];
}) => { }) => {
const { styles } = useStyles();
const columns = [ const columns = [
{ {
title: '排名', title: '排名',

12
src/pages/dashboard/analysis/index.tsx

@ -18,7 +18,8 @@ import type { AnalysisData } from './data.d';
import { fakeChartData } from './service'; import { fakeChartData } from './service';
import useStyles from './style.style'; import useStyles from './style.style';
import { getTimeDistance } from './utils/utils'; import { getTimeDistance } from './utils/utils';
type RangePickerValue = RangePickerProps<dayjs.Dayjs>['value']; type RangePickerValue = RangePickerProps<dayjs.Dayjs>[
'value'];
type AnalysisProps = { type AnalysisProps = {
dashboardAndanalysis: AnalysisData; dashboardAndanalysis: AnalysisData;
loading: boolean; loading: boolean;
@ -58,8 +59,7 @@ const Analysis: FC<AnalysisProps> = () => {
return ''; return '';
}; };
let salesPieData; let salesPieData: any;
if (salesType === 'all') { if (salesType === 'all') {
salesPieData = data?.salesTypeData; salesPieData = data?.salesTypeData;
} else { } else {
@ -93,10 +93,10 @@ const Analysis: FC<AnalysisProps> = () => {
const handleTabChange = (key: string) => { const handleTabChange = (key: string) => {
setCurrentTabKey(key); setCurrentTabKey(key);
}; };
const activeKey = currentTabKey || (data?.offlineData[0] && data?.offlineData[0].name) || ''; const activeKey = currentTabKey || (data?.offlineData[0]?.name) || '';
return ( return (
<GridContent> <GridContent>
<>
<Suspense fallback={<PageLoading />}> <Suspense fallback={<PageLoading />}>
<IntroduceRow loading={loading} visitData={data?.visitData || []} /> <IntroduceRow loading={loading} visitData={data?.visitData || []} />
</Suspense> </Suspense>
@ -150,7 +150,7 @@ const Analysis: FC<AnalysisProps> = () => {
handleTabChange={handleTabChange} handleTabChange={handleTabChange}
/> />
</Suspense> </Suspense>
</>
</GridContent> </GridContent>
); );
}; };

10
src/pages/dashboard/monitor/components/ActiveChart/index.tsx

@ -1,6 +1,6 @@
import { Area } from '@ant-design/plots'; import { Area } from '@ant-design/plots';
import { Statistic } from 'antd'; import { Statistic } from 'antd';
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState, useCallback } from 'react';
import useStyles from './index.style'; import useStyles from './index.style';
function fixedZero(val: number) { function fixedZero(val: number) {
return val * 1 < 10 ? `0${val}` : val; return val * 1 < 10 ? `0${val}` : val;
@ -21,24 +21,24 @@ const ActiveChart = () => {
const requestRef = useRef<number | null>(null); const requestRef = useRef<number | null>(null);
const { styles } = useStyles(); const { styles } = useStyles();
const [activeData, setActiveData] = useState<{ x: string; y: number }[]>([]); const [activeData, setActiveData] = useState<{ x: string; y: number }[]>([]);
const loopData = () => { const loopData = useCallback(() => {
requestRef.current = requestAnimationFrame(() => { requestRef.current = requestAnimationFrame(() => {
timerRef.current = window.setTimeout(() => { timerRef.current = window.setTimeout(() => {
setActiveData(getActiveData()); setActiveData(getActiveData());
loopData(); loopData();
}, 2000); }, 2000);
}); });
}; }, []);
useEffect(() => { useEffect(() => {
loopData(); loopData();
return () => { return () => {
clearTimeout(timerRef.current!); clearTimeout(timerRef.current as number);
if (requestRef.current) { if (requestRef.current) {
cancelAnimationFrame(requestRef.current); cancelAnimationFrame(requestRef.current);
} }
}; };
}, []); }, [loopData]);
return ( return (
<div className={styles.activeChart}> <div className={styles.activeChart}>

8
src/pages/dashboard/monitor/components/Charts/WaterWave/index.tsx

@ -185,7 +185,9 @@ class WaterWave extends Component<WaterWaveProps> {
return ( return (
<div <div
className={styles.waterWave} className={styles.waterWave}
ref={(n) => (this.root = n)} ref={(n) => {
this.root = n;
}}
style={{ style={{
transform: `scale(${radio})`, transform: `scale(${radio})`,
}} }}
@ -199,7 +201,9 @@ class WaterWave extends Component<WaterWaveProps> {
> >
<canvas <canvas
className={styles.waterWaveCanvasWrapper} className={styles.waterWaveCanvasWrapper}
ref={(n) => (this.node = n)} ref={(n) => {
this.node = n;
}}
width={height * 2} width={height * 2}
height={height * 2} height={height * 2}
/> />

2
src/pages/dashboard/monitor/components/Map/index.tsx

@ -3,7 +3,7 @@ import { HeatmapLayer, MapboxScene, PointLayer } from '@antv/l7-react';
import * as React from 'react'; import * as React from 'react';
const colors = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594']; const colors = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'];
export default class Map extends React.Component { export default class MonitorMap extends React.Component {
state = { state = {
data: null, data: null,
grid: null, grid: null,

7
src/pages/dashboard/monitor/index.tsx

@ -5,7 +5,7 @@ import { Card, Col, Progress, Row, Statistic } from 'antd';
import numeral from 'numeral'; import numeral from 'numeral';
import type { FC } from 'react'; import type { FC } from 'react';
import ActiveChart from './components/ActiveChart'; import ActiveChart from './components/ActiveChart';
import Map from './components/Map'; import MonitorMap from './components/Map';
import { queryTags } from './service'; import { queryTags } from './service';
import useStyles from './style.style'; import useStyles from './style.style';
@ -24,7 +24,6 @@ const Monitor: FC = () => {
}); });
return ( return (
<GridContent> <GridContent>
<>
<Row gutter={24}> <Row gutter={24}>
<Col <Col
xl={18} xl={18}
@ -56,7 +55,7 @@ const Monitor: FC = () => {
</Col> </Col>
</Row> </Row>
<div className={styles.mapChart}> <div className={styles.mapChart}>
<Map /> <MonitorMap />
</div> </div>
</Card> </Card>
</Col> </Col>
@ -178,7 +177,7 @@ const Monitor: FC = () => {
</Card> </Card>
</Col> </Col>
</Row> </Row>
</>
</GridContent> </GridContent>
); );
}; };

4
src/pages/dashboard/workplace/_mock.ts

@ -4,7 +4,7 @@ import type { DataItem, OfflineDataType, SearchDataType } from './data.d';
// mock data // mock data
const visitData: DataItem[] = []; const visitData: DataItem[] = [];
const beginDay = new Date().getTime(); const beginDay = Date.now();
const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5]; const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5];
for (let i = 0; i < fakeY.length; i += 1) { for (let i = 0; i < fakeY.length; i += 1) {
@ -127,7 +127,7 @@ for (let i = 0; i < 10; i += 1) {
const offlineChartData: DataItem[] = []; const offlineChartData: DataItem[] = [];
for (let i = 0; i < 20; i += 1) { for (let i = 0; i < 20; i += 1) {
offlineChartData.push({ offlineChartData.push({
x: new Date().getTime() + 1000 * 60 * 30 * i, x: Date.now()+ 1000 * 60 * 30 * i,
y1: Math.floor(Math.random() * 100) + 10, y1: Math.floor(Math.random() * 100) + 10,
y2: Math.floor(Math.random() * 100) + 10, y2: Math.floor(Math.random() * 100) + 10,
}); });

4
src/pages/form/advanced-form/components/TableForm.tsx

@ -72,7 +72,7 @@ const TableForm: FC<TableFormProps> = ({ value, onChange }) => {
) => { ) => {
const newData = [...(data as TableFormDateType[])]; const newData = [...(data as TableFormDateType[])];
const target = getRowByKey(key, newData); const target = getRowByKey(key, newData);
if (target && target[fieldName]) { if (target?.[fieldName]) {
target[fieldName as 'key'] = e.target.value; target[fieldName as 'key'] = e.target.value;
setData(newData); setData(newData);
} }
@ -191,7 +191,7 @@ const TableForm: FC<TableFormProps> = ({ value, onChange }) => {
{ {
title: '操作', title: '操作',
key: 'action', key: 'action',
render: (text: string, record: TableFormDateType) => { render: (_text: string, record: TableFormDateType) => {
if (!!record.editable && loading) { if (!!record.editable && loading) {
return null; return null;
} }

6
src/pages/form/advanced-form/index.tsx

@ -97,7 +97,7 @@ const AdvancedForm: FC<Record<string, any>> = () => {
overlayClassName={styles.errorPopover} overlayClassName={styles.errorPopover}
trigger="click" trigger="click"
getPopupContainer={(trigger: HTMLElement) => { getPopupContainer={(trigger: HTMLElement) => {
if (trigger && trigger.parentNode) { if (trigger?.parentNode) {
return trigger.parentNode as HTMLElement; return trigger.parentNode as HTMLElement;
} }
return trigger; return trigger;
@ -144,7 +144,7 @@ const AdvancedForm: FC<Record<string, any>> = () => {
title: '操作', title: '操作',
key: 'action', key: 'action',
valueType: 'option', valueType: 'option',
render: (_, record: TableFormDateType, index, action) => { render: (_, record: TableFormDateType, _index, action) => {
return [ return [
<a <a
key="eidit" key="eidit"
@ -163,7 +163,7 @@ const AdvancedForm: FC<Record<string, any>> = () => {
layout="vertical" layout="vertical"
hideRequiredMark hideRequiredMark
submitter={{ submitter={{
render: (props, dom) => { render: (_props, dom) => {
return ( return (
<FooterToolbar> <FooterToolbar>
{getErrorInfo(error)} {getErrorInfo(error)}

6
src/pages/list/basic-list/_mock.ts

@ -66,8 +66,8 @@ function fakeList(count: number): BasicListItemDataType[] {
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
href: 'https://ant.design', href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), updatedAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), createdAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5], subDescription: desc[i % 5],
description: description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
@ -139,7 +139,7 @@ function postFakeList(req: Request, res: Response) {
result.unshift({ result.unshift({
...body, ...body,
id: `fake-list-${result.length}`, id: `fake-list-${result.length}`,
createdAt: new Date().getTime(), createdAt: Date.now(),
}); });
break; break;
default: default:

2
src/pages/list/basic-list/components/OperationModal.tsx

@ -36,7 +36,7 @@ const OperationModal: FC<OperationModalProps> = (props) => {
submitter={{ submitter={{
render: (_, dom) => (done ? null : dom), render: (_, dom) => (done ? null : dom),
}} }}
trigger={<>{children}</>} trigger={children}
modalProps={{ modalProps={{
onCancel: () => onDone(), onCancel: () => onDone(),
destroyOnClose: true, destroyOnClose: true,

4
src/pages/list/card-list/_mock.ts

@ -66,8 +66,8 @@ function fakeList(count: number): CardListItemDataType[] {
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
href: 'https://ant.design', href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), updatedAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), createdAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5], subDescription: desc[i % 5],
description: description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',

2
src/pages/list/card-list/index.tsx

@ -62,7 +62,7 @@ const CardList = () => {
}} }}
dataSource={[nullData, ...list]} dataSource={[nullData, ...list]}
renderItem={(item) => { renderItem={(item) => {
if (item && item.id) { if (item?.id) {
return ( return (
<List.Item key={item.id}> <List.Item key={item.id}>
<Card <Card

4
src/pages/list/search/applications/_mock.ts

@ -65,8 +65,8 @@ function fakeList(count: number): ListItemDataType[] {
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
href: 'https://ant.design', href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), updatedAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), createdAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5], subDescription: desc[i % 5],
description: description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',

5
src/pages/list/search/applications/components/TagSelect/index.tsx

@ -18,7 +18,7 @@ const TagSelectOption: React.FC<TagSelectOptionProps> & {
<CheckableTag <CheckableTag
checked={!!checked} checked={!!checked}
key={value} key={value}
onChange={(state) => onChange && onChange(value, state)} onChange={(state) => onChange?.(value, state)}
> >
{children} {children}
</CheckableTag> </CheckableTag>
@ -58,8 +58,7 @@ const TagSelect: FC<TagSelectProps> & {
}); });
const isTagSelectOption = (node: TagSelectOptionElement) => const isTagSelectOption = (node: TagSelectOptionElement) =>
node && node?.type &&
node.type &&
(node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption'); (node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption');
const getAllTags = () => { const getAllTags = () => {
const childrenArray = React.Children.toArray(children) as TagSelectOptionElement[]; const childrenArray = React.Children.toArray(children) as TagSelectOptionElement[];

15
src/pages/list/search/applications/index.tsx

@ -95,11 +95,16 @@ export const Applications: FC<Record<string, any>> = () => {
> >
<Form.Item name="category"> <Form.Item name="category">
<TagSelect expandable> <TagSelect expandable>
{categoryOptions.map((category) => ( {categoryOptions
<TagSelect.Option value={category.value!} key={category.value}> .filter(
{category.label} (category): category is { value: string | number; label: string } =>
</TagSelect.Option> category.value !== undefined && category.value !== null
))} )
.map((category) => (
<TagSelect.Option value={category.value} key={category.value}>
{category.label}
</TagSelect.Option>
))}
</TagSelect> </TagSelect>
</Form.Item> </Form.Item>
</StandardFormRow> </StandardFormRow>

4
src/pages/list/search/articles/_mock.ts

@ -65,8 +65,8 @@ function fakeList(count: number): ListItemDataType[] {
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
href: 'https://ant.design', href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), updatedAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), createdAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5], subDescription: desc[i % 5],
description: description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',

5
src/pages/list/search/articles/components/TagSelect/index.tsx

@ -18,7 +18,7 @@ const TagSelectOption: React.FC<TagSelectOptionProps> & {
<CheckableTag <CheckableTag
checked={!!checked} checked={!!checked}
key={value} key={value}
onChange={(state) => onChange && onChange(value, state)} onChange={(state) => onChange?.(value, state)}
> >
{children} {children}
</CheckableTag> </CheckableTag>
@ -58,8 +58,7 @@ const TagSelect: FC<TagSelectProps> & {
}); });
const isTagSelectOption = (node: TagSelectOptionElement) => const isTagSelectOption = (node: TagSelectOptionElement) =>
node && node?.type &&
node.type &&
(node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption'); (node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption');
const getAllTags = () => { const getAllTags = () => {
const childrenArray = React.Children.toArray(children) as TagSelectOptionElement[]; const childrenArray = React.Children.toArray(children) as TagSelectOptionElement[];

17
src/pages/list/search/articles/index.tsx

@ -122,7 +122,7 @@ const Articles: FC = () => {
label: item.name, label: item.name,
value: item.id, value: item.id,
})), })),
[owners], [],
); );
return ( return (
@ -139,11 +139,16 @@ const Articles: FC = () => {
<StandardFormRow title="所属类目" block style={{ paddingBottom: 11 }}> <StandardFormRow title="所属类目" block style={{ paddingBottom: 11 }}>
<FormItem name="category"> <FormItem name="category">
<TagSelect expandable> <TagSelect expandable>
{categoryOptions.map((category) => ( {categoryOptions
<TagSelect.Option value={category.value!} key={category.value}> .filter(
{category.label} (category): category is { value: string | number; label: string } =>
</TagSelect.Option> category.value !== undefined && category.value !== null
))} )
.map((category) => (
<TagSelect.Option value={category.value} key={category.value}>
{category.label}
</TagSelect.Option>
))}
</TagSelect> </TagSelect>
</FormItem> </FormItem>
</StandardFormRow> </StandardFormRow>

4
src/pages/list/search/projects/_mock.ts

@ -65,8 +65,8 @@ function fakeList(count: number): ListItemDataType[] {
percent: Math.ceil(Math.random() * 50) + 50, percent: Math.ceil(Math.random() * 50) + 50,
logo: avatars[i % 8], logo: avatars[i % 8],
href: 'https://ant.design', href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), updatedAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(), createdAt: new Date(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5], subDescription: desc[i % 5],
description: description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。', '在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',

4
src/pages/list/search/projects/components/AvatarList/index.tsx

@ -28,7 +28,7 @@ const avatarSizeToClassName = (size: SizeType | 'mini', styles: any) =>
const Item: React.FC<AvatarItemProps> = ({ src, size, tips, onClick = () => {} }) => { const Item: React.FC<AvatarItemProps> = ({ src, size, tips, onClick = () => {} }) => {
const { styles } = useStyles(); const { styles } = useStyles();
const cls = avatarSizeToClassName(size!, styles); const cls = avatarSizeToClassName(size || 'default', styles);
return ( return (
<li className={cls} onClick={onClick}> <li className={cls} onClick={onClick}>
@ -62,7 +62,7 @@ const AvatarList: React.FC<AvatarListProps> & {
}), }),
); );
if (numToShow < numOfChildren) { if (numToShow < numOfChildren) {
const cls = avatarSizeToClassName(size!, styles); const cls = avatarSizeToClassName(size || 'default', styles);
childrenWithProps.push( childrenWithProps.push(
<li key="exceed" className={cls}> <li key="exceed" className={cls}>
<Avatar size={size} style={excessItemsStyle}>{`+${numOfChildren - maxLength}`}</Avatar> <Avatar size={size} style={excessItemsStyle}>{`+${numOfChildren - maxLength}`}</Avatar>

5
src/pages/list/search/projects/components/TagSelect/index.tsx

@ -18,7 +18,7 @@ const TagSelectOption: React.FC<TagSelectOptionProps> & {
<CheckableTag <CheckableTag
checked={!!checked} checked={!!checked}
key={value} key={value}
onChange={(state) => onChange && onChange(value, state)} onChange={(state) => onChange?.(value, state)}
> >
{children} {children}
</CheckableTag> </CheckableTag>
@ -58,8 +58,7 @@ const TagSelect: FC<TagSelectProps> & {
}); });
const isTagSelectOption = (node: TagSelectOptionElement) => const isTagSelectOption = (node: TagSelectOptionElement) =>
node && node?.type &&
node.type &&
(node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption'); (node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption');
const getAllTags = () => { const getAllTags = () => {
const childrenArray = React.Children.toArray(children) as TagSelectOptionElement[]; const childrenArray = React.Children.toArray(children) as TagSelectOptionElement[];

15
src/pages/list/search/projects/index.tsx

@ -103,11 +103,16 @@ const Projects: FC = () => {
> >
<FormItem name="category"> <FormItem name="category">
<TagSelect expandable> <TagSelect expandable>
{categoryOptions.map((category) => ( {categoryOptions
<TagSelect.Option value={category.value!} key={category.value}> .filter(
{category.label} (category): category is { value: string | number; label: string } =>
</TagSelect.Option> category.value !== undefined && category.value !== null
))} )
.map((category) => (
<TagSelect.Option value={category.value} key={category.value}>
{category.label}
</TagSelect.Option>
))}
</TagSelect> </TagSelect>
</FormItem> </FormItem>
</StandardFormRow> </StandardFormRow>

4
src/pages/list/table-list/_mock.ts

@ -1,5 +1,5 @@
import type { Request, Response } from 'express'; import type { Request, Response } from 'express';
import { parse } from 'url'; import { parse } from 'node:url';
import type { TableListItem, TableListParams } from './data.d'; import type { TableListItem, TableListParams } from './data.d';
// mock tableListDataSource // mock tableListDataSource
@ -109,7 +109,7 @@ function postRule(req: Request, res: Response, u: string, b: Request) {
realUrl = req.url; realUrl = req.url;
} }
const body = (b && b.body) || req.body; const body = (b?.body) || req.body;
const { name, desc, key } = body; const { name, desc, key } = body;
switch (req.method) { switch (req.method) {

8
src/pages/list/table-list/index.tsx

@ -29,7 +29,7 @@ const handleAdd = async (fields: TableListItem) => {
hide(); hide();
message.success('添加成功'); message.success('添加成功');
return true; return true;
} catch (error) { } catch (_error) {
hide(); hide();
message.error('添加失败请重试!'); message.error('添加失败请重试!');
return false; return false;
@ -52,7 +52,7 @@ const handleUpdate = async (fields: FormValueType, currentRow?: TableListItem) =
hide(); hide();
message.success('配置成功'); message.success('配置成功');
return true; return true;
} catch (error) { } catch (_error) {
hide(); hide();
message.error('配置失败请重试!'); message.error('配置失败请重试!');
return false; return false;
@ -75,7 +75,7 @@ const handleRemove = async (selectedRows: TableListItem[]) => {
hide(); hide();
message.success('删除成功,即将刷新'); message.success('删除成功,即将刷新');
return true; return true;
} catch (error) { } catch (_error) {
hide(); hide();
message.error('删除失败,请重试'); message.error('删除失败,请重试');
return false; return false;
@ -229,7 +229,7 @@ const TableList: React.FC = () => {
</a>{' '} </a>{' '}
&nbsp;&nbsp; &nbsp;&nbsp;
<span> <span>
{selectedRowsState.reduce((pre, item) => pre + item.callNo!, 0)} {selectedRowsState.reduce((pre, item) => pre + (item.callNo ?? 0), 0)}
</span> </span>
</div> </div>
} }

2
src/pages/profile/advanced/_mock.ts

@ -65,7 +65,7 @@ const advancedOperation3 = [
}, },
]; ];
function getProfileAdvancedData(req: Request, res: Response) { function getProfileAdvancedData(_req: Request, res: Response) {
const result = { const result = {
data: { data: {
advancedOperation1, advancedOperation1,

2
src/pages/table-list/index.tsx

@ -215,7 +215,7 @@ const TableList: React.FC = () => {
}, },
}); });
}, },
[delRun], [delRun, messageApi.warning],
); );
return ( return (

3
src/pages/user/login/login.test.tsx

@ -1,5 +1,4 @@
// @ts-ignore import { startMock } from '@@/requestRecordMock';
import { startMock } from '@@/requestRecordMock';
import { TestBrowser } from '@@/testBrowser'; import { TestBrowser } from '@@/testBrowser';
import { fireEvent, render } from '@testing-library/react'; import { fireEvent, render } from '@testing-library/react';
import React, { act } from 'react'; import React, { act } from 'react';

4
src/pages/user/register/index.tsx

@ -123,7 +123,7 @@ const Register: FC = () => {
const renderPasswordProgress = () => { const renderPasswordProgress = () => {
const value = form.getFieldValue('password'); const value = form.getFieldValue('password');
const passwordStatus = getPasswordStatus(); const passwordStatus = getPasswordStatus();
return value && value.length ? ( return value?.length ? (
<div className={styles[`progress-${passwordStatus}`]}> <div className={styles[`progress-${passwordStatus}`]}>
<Progress <Progress
status={passwordProgressMap[passwordStatus]} status={passwordProgressMap[passwordStatus]}
@ -155,7 +155,7 @@ const Register: FC = () => {
</FormItem> </FormItem>
<Popover <Popover
getPopupContainer={(node) => { getPopupContainer={(node) => {
if (node && node.parentNode) { if (node?.parentNode) {
return node.parentNode as HTMLElement; return node.parentNode as HTMLElement;
} }
return node; return node;

Loading…
Cancel
Save