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": {
"noStaticElementInteractions": "off",
"useValidAnchor": "off"
"useValidAnchor": "off",
"useKeyWithClickEvents": "off"
}
}
},

8
package.json

@ -43,7 +43,11 @@
"classnames": "^2.5.1",
"dayjs": "^1.11.13",
"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": {
"@ant-design/pro-cli": "^3.3.0",
@ -104,4 +108,4 @@
"create-umi"
]
}
}
}

2
src/global.style.ts

@ -1,6 +1,6 @@
import { createStyles } from 'antd-style';
const useStyles = createStyles(({}) => {
const useStyles = createStyles(() => {
return {
colorWeak: {
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,
logo: avatars[i % 8],
href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: 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(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5],
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({
data: currentUseDetail,
});

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

@ -223,8 +223,7 @@ const Center: React.FC = () => {
<div className={styles.team}>
<div className={styles.teamTitle}></div>
<Row gutter={36}>
{currentUser.notice &&
currentUser.notice.map((item) => (
{currentUser.notice?.map((item) => (
<Col key={item.id} lg={24} xl={12}>
<a href={item.href}>
<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({
data: {
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 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]) {
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();
return (
<>
<List<Unpacked<typeof data>>
<List<Unpacked<typeof data>>
itemLayout="horizontal"
dataSource={data}
renderItem={(item) => (
@ -55,7 +54,6 @@ const SecurityView: React.FC = () => {
</List.Item>
)}
/>
</>
);
};

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

@ -51,7 +51,7 @@ const Settings: React.FC = () => {
return () => {
window.removeEventListener('resize', resize);
};
}, [dom.current]);
}, [resize]);
const getMenu = () => {
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
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];
for (let i = 0; i < fakeY.length; i += 1) {
@ -126,7 +126,7 @@ for (let i = 0; i < 10; i += 1) {
}
const offlineChartData = [];
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({
date,
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) {
return null;
}
let totalDom;
let totalDom: React.ReactNode | null = null;
switch (typeof total) {
case 'undefined':
totalDom = null;
@ -63,7 +63,7 @@ const ChartCard: React.FC<ChartCardProps> = (props) => {
height: contentHeight || 'auto',
}}
>
<div className={contentHeight && styles.contentFixed}>{children}</div>
<div className={contentHeight ? styles.contentFixed : undefined}>{children}</div>
</div>
)}
{footer && (
@ -81,20 +81,15 @@ const ChartCard: React.FC<ChartCardProps> = (props) => {
const {
loading = false,
contentHeight,
title,
avatar,
action,
total,
footer,
children,
...rest
} = props;
return (
<Card
loading={loading}
bodyStyle={{
padding: '20px 24px 8px 24px',
styles={{
body: {
padding: '20px 24px 8px 24px',
},
}}
{...rest}
>

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

@ -185,7 +185,9 @@ class WaterWave extends Component<WaterWaveProps> {
return (
<div
className={styles.waterWave}
ref={(n) => (this.root = n)}
ref={(n) => {
this.root = n;
}}
style={{
transform: `scale(${radio})`,
}}
@ -199,7 +201,9 @@ class WaterWave extends Component<WaterWaveProps> {
>
<canvas
className={styles.waterWaveCanvasWrapper}
ref={(n) => (this.node = n)}
ref={(n) => {
this.node = n;
}}
width={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 React from 'react';
import type { DataItem } from '../data.d';
import useStyles from '../style.style';
import NumberInfo from './NumberInfo';
import Trend from './Trend';
@ -19,7 +18,6 @@ const TopSearch = ({
dropdownGroup: React.ReactNode;
searchData: DataItem[];
}) => {
const { styles } = useStyles();
const columns = [
{
title: '排名',

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

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

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

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

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

@ -185,7 +185,9 @@ class WaterWave extends Component<WaterWaveProps> {
return (
<div
className={styles.waterWave}
ref={(n) => (this.root = n)}
ref={(n) => {
this.root = n;
}}
style={{
transform: `scale(${radio})`,
}}
@ -199,7 +201,9 @@ class WaterWave extends Component<WaterWaveProps> {
>
<canvas
className={styles.waterWaveCanvasWrapper}
ref={(n) => (this.node = n)}
ref={(n) => {
this.node = n;
}}
width={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';
const colors = ['#eff3ff', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#084594'];
export default class Map extends React.Component {
export default class MonitorMap extends React.Component {
state = {
data: 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 type { FC } from 'react';
import ActiveChart from './components/ActiveChart';
import Map from './components/Map';
import MonitorMap from './components/Map';
import { queryTags } from './service';
import useStyles from './style.style';
@ -24,7 +24,6 @@ const Monitor: FC = () => {
});
return (
<GridContent>
<>
<Row gutter={24}>
<Col
xl={18}
@ -56,7 +55,7 @@ const Monitor: FC = () => {
</Col>
</Row>
<div className={styles.mapChart}>
<Map />
<MonitorMap />
</div>
</Card>
</Col>
@ -178,7 +177,7 @@ const Monitor: FC = () => {
</Card>
</Col>
</Row>
</>
</GridContent>
);
};

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

@ -4,7 +4,7 @@ import type { DataItem, OfflineDataType, SearchDataType } from './data.d';
// mock data
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];
for (let i = 0; i < fakeY.length; i += 1) {
@ -127,7 +127,7 @@ for (let i = 0; i < 10; i += 1) {
const offlineChartData: DataItem[] = [];
for (let i = 0; i < 20; i += 1) {
offlineChartData.push({
x: new Date().getTime() + 1000 * 60 * 30 * i,
x: Date.now()+ 1000 * 60 * 30 * i,
y1: 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 target = getRowByKey(key, newData);
if (target && target[fieldName]) {
if (target?.[fieldName]) {
target[fieldName as 'key'] = e.target.value;
setData(newData);
}
@ -191,7 +191,7 @@ const TableForm: FC<TableFormProps> = ({ value, onChange }) => {
{
title: '操作',
key: 'action',
render: (text: string, record: TableFormDateType) => {
render: (_text: string, record: TableFormDateType) => {
if (!!record.editable && loading) {
return null;
}

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

@ -97,7 +97,7 @@ const AdvancedForm: FC<Record<string, any>> = () => {
overlayClassName={styles.errorPopover}
trigger="click"
getPopupContainer={(trigger: HTMLElement) => {
if (trigger && trigger.parentNode) {
if (trigger?.parentNode) {
return trigger.parentNode as HTMLElement;
}
return trigger;
@ -144,7 +144,7 @@ const AdvancedForm: FC<Record<string, any>> = () => {
title: '操作',
key: 'action',
valueType: 'option',
render: (_, record: TableFormDateType, index, action) => {
render: (_, record: TableFormDateType, _index, action) => {
return [
<a
key="eidit"
@ -163,7 +163,7 @@ const AdvancedForm: FC<Record<string, any>> = () => {
layout="vertical"
hideRequiredMark
submitter={{
render: (props, dom) => {
render: (_props, dom) => {
return (
<FooterToolbar>
{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,
logo: avatars[i % 8],
href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: 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(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5],
description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',
@ -139,7 +139,7 @@ function postFakeList(req: Request, res: Response) {
result.unshift({
...body,
id: `fake-list-${result.length}`,
createdAt: new Date().getTime(),
createdAt: Date.now(),
});
break;
default:

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

@ -36,7 +36,7 @@ const OperationModal: FC<OperationModalProps> = (props) => {
submitter={{
render: (_, dom) => (done ? null : dom),
}}
trigger={<>{children}</>}
trigger={children}
modalProps={{
onCancel: () => onDone(),
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,
logo: avatars[i % 8],
href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: 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(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5],
description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',

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

@ -62,7 +62,7 @@ const CardList = () => {
}}
dataSource={[nullData, ...list]}
renderItem={(item) => {
if (item && item.id) {
if (item?.id) {
return (
<List.Item key={item.id}>
<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,
logo: avatars[i % 8],
href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: 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(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5],
description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',

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

@ -18,7 +18,7 @@ const TagSelectOption: React.FC<TagSelectOptionProps> & {
<CheckableTag
checked={!!checked}
key={value}
onChange={(state) => onChange && onChange(value, state)}
onChange={(state) => onChange?.(value, state)}
>
{children}
</CheckableTag>
@ -58,8 +58,7 @@ const TagSelect: FC<TagSelectProps> & {
});
const isTagSelectOption = (node: TagSelectOptionElement) =>
node &&
node.type &&
node?.type &&
(node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption');
const getAllTags = () => {
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">
<TagSelect expandable>
{categoryOptions.map((category) => (
<TagSelect.Option value={category.value!} key={category.value}>
{category.label}
</TagSelect.Option>
))}
{categoryOptions
.filter(
(category): category is { value: string | number; label: string } =>
category.value !== undefined && category.value !== null
)
.map((category) => (
<TagSelect.Option value={category.value} key={category.value}>
{category.label}
</TagSelect.Option>
))}
</TagSelect>
</Form.Item>
</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,
logo: avatars[i % 8],
href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: 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(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5],
description:
'在中台产品的研发过程中,会出现不同的设计规范和实现方式,但其中往往存在很多类似的页面和组件,这些类似的组件会被抽离成一套标准规范。',

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

@ -18,7 +18,7 @@ const TagSelectOption: React.FC<TagSelectOptionProps> & {
<CheckableTag
checked={!!checked}
key={value}
onChange={(state) => onChange && onChange(value, state)}
onChange={(state) => onChange?.(value, state)}
>
{children}
</CheckableTag>
@ -58,8 +58,7 @@ const TagSelect: FC<TagSelectProps> & {
});
const isTagSelectOption = (node: TagSelectOptionElement) =>
node &&
node.type &&
node?.type &&
(node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption');
const getAllTags = () => {
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,
value: item.id,
})),
[owners],
[],
);
return (
@ -139,11 +139,16 @@ const Articles: FC = () => {
<StandardFormRow title="所属类目" block style={{ paddingBottom: 11 }}>
<FormItem name="category">
<TagSelect expandable>
{categoryOptions.map((category) => (
<TagSelect.Option value={category.value!} key={category.value}>
{category.label}
</TagSelect.Option>
))}
{categoryOptions
.filter(
(category): category is { value: string | number; label: string } =>
category.value !== undefined && category.value !== null
)
.map((category) => (
<TagSelect.Option value={category.value} key={category.value}>
{category.label}
</TagSelect.Option>
))}
</TagSelect>
</FormItem>
</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,
logo: avatars[i % 8],
href: 'https://ant.design',
updatedAt: new Date(new Date().getTime() - 1000 * 60 * 60 * 2 * i).getTime(),
createdAt: 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(Date.now()- 1000 * 60 * 60 * 2 * i).getTime(),
subDescription: desc[i % 5],
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 { styles } = useStyles();
const cls = avatarSizeToClassName(size!, styles);
const cls = avatarSizeToClassName(size || 'default', styles);
return (
<li className={cls} onClick={onClick}>
@ -62,7 +62,7 @@ const AvatarList: React.FC<AvatarListProps> & {
}),
);
if (numToShow < numOfChildren) {
const cls = avatarSizeToClassName(size!, styles);
const cls = avatarSizeToClassName(size || 'default', styles);
childrenWithProps.push(
<li key="exceed" className={cls}>
<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
checked={!!checked}
key={value}
onChange={(state) => onChange && onChange(value, state)}
onChange={(state) => onChange?.(value, state)}
>
{children}
</CheckableTag>
@ -58,8 +58,7 @@ const TagSelect: FC<TagSelectProps> & {
});
const isTagSelectOption = (node: TagSelectOptionElement) =>
node &&
node.type &&
node?.type &&
(node.type.isTagSelectOption || node.type.displayName === 'TagSelectOption');
const getAllTags = () => {
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">
<TagSelect expandable>
{categoryOptions.map((category) => (
<TagSelect.Option value={category.value!} key={category.value}>
{category.label}
</TagSelect.Option>
))}
{categoryOptions
.filter(
(category): category is { value: string | number; label: string } =>
category.value !== undefined && category.value !== null
)
.map((category) => (
<TagSelect.Option value={category.value} key={category.value}>
{category.label}
</TagSelect.Option>
))}
</TagSelect>
</FormItem>
</StandardFormRow>

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

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

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

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

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

@ -215,7 +215,7 @@ const TableList: React.FC = () => {
},
});
},
[delRun],
[delRun, messageApi.warning],
);
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 { fireEvent, render } from '@testing-library/react';
import React, { act } from 'react';

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

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

Loading…
Cancel
Save