diff --git a/mock/analysis.mock.ts b/mock/analysis.mock.ts index 56451d52..b09b8b07 100644 --- a/mock/analysis.mock.ts +++ b/mock/analysis.mock.ts @@ -1,6 +1,6 @@ import dayjs from 'dayjs'; import type { Request, Response } from 'express'; -import type { AnalysisData, DataItem, RadarData } from './data'; +import type { AnalysisData, DataItem, RadarData } from '../src/pages/dashboard/analysis/data'; // mock data const visitData: DataItem[] = []; diff --git a/mock/workplace.mock.ts b/mock/workplace.mock.ts index 896d857e..8640d56d 100644 --- a/mock/workplace.mock.ts +++ b/mock/workplace.mock.ts @@ -1,6 +1,6 @@ -import { DataItem } from '@antv/g2plot/esm/interface/config'; import dayjs from 'dayjs'; import type { Request, Response } from 'express'; +import type { DataItem, OfflineDataType } from '../src/pages/dashboard/workplace/data.d'; export type SearchDataType = { index: number; diff --git a/package.json b/package.json index 008c33d7..361731cd 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "cross-env": "^7.0.3", "express": "^4.21.1", "gh-pages": "^6.1.1", - "husky": "^9.1.6", + "husky": "^9.1.7", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "lint-staged": "^16.1.2", diff --git a/src/pages/account/center/components/Applications/index.tsx b/src/pages/account/center/components/Applications/index.tsx index a60e072d..f0f46237 100644 --- a/src/pages/account/center/components/Applications/index.tsx +++ b/src/pages/account/center/components/Applications/index.tsx @@ -91,16 +91,18 @@ const Applications: React.FC = () => { , diff --git a/src/pages/account/center/components/AvatarList/index.tsx b/src/pages/account/center/components/AvatarList/index.tsx index 89e24517..67894e6e 100644 --- a/src/pages/account/center/components/AvatarList/index.tsx +++ b/src/pages/account/center/components/AvatarList/index.tsx @@ -20,6 +20,14 @@ export type AvatarListProps = { | React.ReactElement | React.ReactElement[]; }; + +const avatarSizeToClassName = (styles: any, size?: SizeType | 'mini') => + classNames(styles.avatarItem, { + [styles.avatarItemLarge]: size === 'large', + [styles.avatarItemSmall]: size === 'small', + [styles.avatarItemMini]: size === 'mini', + }); + const Item: React.FC = ({ src, size, @@ -27,13 +35,7 @@ const Item: React.FC = ({ onClick = () => {}, }) => { const { styles } = useStyles(); - const avatarSizeToClassName = (size?: SizeType | 'mini') => - classNames(styles.avatarItem, { - [styles.avatarItemLarge]: size === 'large', - [styles.avatarItemSmall]: size === 'small', - [styles.avatarItemMini]: size === 'mini', - }); - const cls = avatarSizeToClassName(size); + const cls = avatarSizeToClassName(styles, size); return (
  • {tips ? ( @@ -67,7 +69,7 @@ const AvatarList: React.FC & { }), ); if (numToShow < numOfChildren) { - const cls = avatarSizeToClassName(size); + const cls = avatarSizeToClassName(styles, size); childrenWithProps.push(
  • { labelInValue: true, }} name="province" - className={styles.item} request={async () => { return queryProvince().then(({ data }) => { return data.map((item) => { @@ -175,7 +174,6 @@ const BaseView: React.FC = () => { }, ]} disabled={!province} - className={styles.item} request={async () => { if (!province?.key) { return []; diff --git a/src/pages/dashboard/analysis/components/Charts/MiniProgress/index.tsx b/src/pages/dashboard/analysis/components/Charts/MiniProgress/index.tsx index 30f41945..55042285 100644 --- a/src/pages/dashboard/analysis/components/Charts/MiniProgress/index.tsx +++ b/src/pages/dashboard/analysis/components/Charts/MiniProgress/index.tsx @@ -1,6 +1,5 @@ import { Tooltip } from 'antd'; import React from 'react'; -import useStyles from './index.style'; export type MiniProgressProps = { target: number; targetLabel?: string; @@ -16,12 +15,10 @@ const MiniProgress: React.FC = ({ strokeWidth, percent, }) => { - const { styles } = useStyles(); return ( -
    +
    = ({ />
    -
    -
    -
    +
    ); }; diff --git a/src/pages/dashboard/analysis/components/Charts/WaterWave/index.tsx b/src/pages/dashboard/analysis/components/Charts/WaterWave/index.tsx index 901be207..62ee38db 100644 --- a/src/pages/dashboard/analysis/components/Charts/WaterWave/index.tsx +++ b/src/pages/dashboard/analysis/components/Charts/WaterWave/index.tsx @@ -1,5 +1,5 @@ import React, { Component } from 'react'; -import autoHeight from '../autoHeight'; +import autoHeight from '../../../../monitor/components/Charts/autoHeight'; /* eslint no-return-assign: 0 */ /* eslint no-mixed-operators: 0 */ @@ -188,7 +188,6 @@ class WaterWave extends Component { const { percent, title, height = 1 } = this.props; return (
    { this.root = n; }} @@ -204,7 +203,6 @@ class WaterWave extends Component { }} > { this.node = n; }} @@ -213,7 +211,6 @@ class WaterWave extends Component { />
    { numberInfoTitle: { marginBottom: '16px', color: token.colorText, - fontSize: token['font-size-lg'], + fontSize: token.fontSizeLG, transition: 'all 0.3s', }, numberInfoSubTitle: { @@ -36,7 +36,7 @@ const useStyles = createStyles(({ token }) => { subTotal: { marginRight: '0', color: token.colorTextSecondary, - fontSize: token['font-size-lg'], + fontSize: token.fontSizeLG, verticalAlign: 'top', }, anticon: { diff --git a/src/pages/dashboard/analysis/components/NumberInfo/index.tsx b/src/pages/dashboard/analysis/components/NumberInfo/index.tsx index fe3062b7..c34f86f5 100644 --- a/src/pages/dashboard/analysis/components/NumberInfo/index.tsx +++ b/src/pages/dashboard/analysis/components/NumberInfo/index.tsx @@ -27,8 +27,8 @@ const NumberInfo: React.FC = ({ const { styles } = useStyles(); return (
    diff --git a/src/pages/dashboard/analysis/components/SalesCard.tsx b/src/pages/dashboard/analysis/components/SalesCard.tsx index 6939acf8..7963e4be 100644 --- a/src/pages/dashboard/analysis/components/SalesCard.tsx +++ b/src/pages/dashboard/analysis/components/SalesCard.tsx @@ -1,6 +1,6 @@ import { Column } from '@ant-design/plots'; import { Card, Col, DatePicker, Row, Tabs } from 'antd'; -import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; +import type { RangePickerProps } from 'antd/es/date-picker'; import type dayjs from 'dayjs'; import numeral from 'numeral'; import type { DataItem } from '../data.d'; @@ -29,11 +29,11 @@ const SalesCard = ({ loading, selectDate, }: { - rangePickerValue: RangePickerProps['value']; + rangePickerValue: RangePickerProps['value']; isActive: (key: TimeType) => string; salesData: DataItem[]; loading: boolean; - handleRangePickerChange: RangePickerProps['onChange']; + handleRangePickerChange: RangePickerProps['onChange']; selectDate: (key: TimeType) => void; }) => { const { styles } = useStyles(); diff --git a/src/pages/dashboard/analysis/data.d.ts b/src/pages/dashboard/analysis/data.d.ts index 7604d10d..f9b69456 100644 --- a/src/pages/dashboard/analysis/data.d.ts +++ b/src/pages/dashboard/analysis/data.d.ts @@ -1,7 +1,6 @@ -import { DataItem } from '@antv/g2plot/esm/interface/config'; - -export { DataItem }; - +export interface DataItem { + [field: string]: string | number | number[] | null | undefined; +} export interface VisitDataType { x: string; y: number; diff --git a/src/pages/dashboard/analysis/index.tsx b/src/pages/dashboard/analysis/index.tsx index 9116b802..9d952777 100644 --- a/src/pages/dashboard/analysis/index.tsx +++ b/src/pages/dashboard/analysis/index.tsx @@ -2,7 +2,7 @@ import { EllipsisOutlined } from '@ant-design/icons'; import { GridContent } from '@ant-design/pro-components'; import { useRequest } from '@umijs/max'; import { Col, Dropdown, Row } from 'antd'; -import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; +import type { RangePickerProps } from 'antd/es/date-picker'; import type { RadioChangeEvent } from 'antd/es/radio'; import type dayjs from 'dayjs'; import type { FC } from 'react'; @@ -19,7 +19,7 @@ import { fakeChartData } from './service'; import useStyles from './style.style'; import { getTimeDistance } from './utils/utils'; -type RangePickerValue = RangePickerProps['value']; +type RangePickerValue = RangePickerProps['value']; type AnalysisProps = { dashboardAndanalysis: AnalysisData; loading: boolean; diff --git a/src/pages/dashboard/analysis/utils/Yuan.tsx b/src/pages/dashboard/analysis/utils/Yuan.tsx index 7027d3c3..a541e7b4 100644 --- a/src/pages/dashboard/analysis/utils/Yuan.tsx +++ b/src/pages/dashboard/analysis/utils/Yuan.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { yuan } from '../components/Charts'; /** 减少使用 dangerouslySetInnerHTML */ export default class Yuan extends React.Component<{ - children: React.ReactText; + children: string | number; }> { main: HTMLSpanElement | undefined | null = null; diff --git a/src/pages/dashboard/analysis/utils/utils.ts b/src/pages/dashboard/analysis/utils/utils.ts index d0b6acdd..6a1d4d5e 100644 --- a/src/pages/dashboard/analysis/utils/utils.ts +++ b/src/pages/dashboard/analysis/utils/utils.ts @@ -1,7 +1,7 @@ -import type { RangePickerProps } from 'antd/es/date-picker/generatePicker'; +import type { RangePickerProps } from 'antd/es/date-picker'; import dayjs from 'dayjs'; -type RangePickerValue = RangePickerProps['value']; +type RangePickerValue = RangePickerProps['value']; export function fixedZero(val: number) { return val * 1 < 10 ? `0${val}` : val; diff --git a/src/pages/dashboard/monitor/components/Charts/WaterWave/index.tsx b/src/pages/dashboard/monitor/components/Charts/WaterWave/index.tsx index 901be207..90ad3eab 100644 --- a/src/pages/dashboard/monitor/components/Charts/WaterWave/index.tsx +++ b/src/pages/dashboard/monitor/components/Charts/WaterWave/index.tsx @@ -188,7 +188,6 @@ class WaterWave extends Component { const { percent, title, height = 1 } = this.props; return (
    { this.root = n; }} @@ -204,7 +203,6 @@ class WaterWave extends Component { }} > { this.node = n; }} @@ -213,7 +211,6 @@ class WaterWave extends Component { />
    = (props) => { const { styles } = useStyles(); - const { links, linkElement, onAdd } = props; + const { links = [], linkElement = 'a', onAdd = () => {} } = props; return (
    {links.map((link) => @@ -34,9 +34,5 @@ const EditableLinkGroup: React.FC = (props) => {
    ); }; -EditableLinkGroup.defaultProps = { - links: [], - onAdd: () => {}, - linkElement: 'a', -}; + export default EditableLinkGroup; diff --git a/src/pages/dashboard/workplace/data.d.ts b/src/pages/dashboard/workplace/data.d.ts index b1114d1e..e9ccf288 100644 --- a/src/pages/dashboard/workplace/data.d.ts +++ b/src/pages/dashboard/workplace/data.d.ts @@ -1,7 +1,6 @@ -import { DataItem } from '@antv/g2plot/esm/interface/config'; - -export { DataItem }; - +export interface DataItem { + [field: string]: string | number | number[] | null | undefined; +} export interface TagType { key: string; label: string; diff --git a/src/pages/form/advanced-form/index.tsx b/src/pages/form/advanced-form/index.tsx index bc9540c2..4beea994 100644 --- a/src/pages/form/advanced-form/index.tsx +++ b/src/pages/form/advanced-form/index.tsx @@ -95,7 +95,7 @@ const AdvancedForm: FC> = () => { onClick={() => scrollToField(key)} > -
    {err.errors[0]}
    +
    {err.errors[0]}
    {fieldLabels[key]}
  • ); diff --git a/src/pages/form/step-form/index.tsx b/src/pages/form/step-form/index.tsx index 0432c660..4ec294a8 100644 --- a/src/pages/form/step-form/index.tsx +++ b/src/pages/form/step-form/index.tsx @@ -82,7 +82,7 @@ const StepForm: React.FC> = () => { receiverMode: 'alipay', }); const [current, setCurrent] = useState(0); - const formRef = useRef(); + const formRef = useRef(null); return ( diff --git a/src/pages/list/table-list/index.tsx b/src/pages/list/table-list/index.tsx index 23ce02c2..bff569b9 100644 --- a/src/pages/list/table-list/index.tsx +++ b/src/pages/list/table-list/index.tsx @@ -98,7 +98,7 @@ const TableList: React.FC = () => { const [updateModalVisible, handleUpdateModalVisible] = useState(false); const [showDetail, setShowDetail] = useState(false); - const actionRef = useRef(); + const actionRef = useRef(null); const [currentRow, setCurrentRow] = useState(); const [selectedRowsState, setSelectedRows] = useState([]); /** 国际化配置 */ diff --git a/src/pages/table-list/components/UpdateForm.tsx b/src/pages/table-list/components/UpdateForm.tsx index bbe0a948..a3195418 100644 --- a/src/pages/table-list/components/UpdateForm.tsx +++ b/src/pages/table-list/components/UpdateForm.tsx @@ -20,7 +20,7 @@ export type FormValueType = { } & Partial; export type UpdateFormProps = { - trigger?: JSX.Element; + trigger?: React.ReactElement; onOk?: () => void; values: Partial; }; diff --git a/src/pages/user/login/login.test.tsx b/src/pages/user/login/login.test.tsx index 36eb6210..c34b6fb3 100644 --- a/src/pages/user/login/login.test.tsx +++ b/src/pages/user/login/login.test.tsx @@ -1,4 +1,5 @@ -import { startMock } from '@@/requestRecordMock'; +// @ts-ignore +import { startMock } from '@@/requestRecordMock'; import { TestBrowser } from '@@/testBrowser'; import { fireEvent, render } from '@testing-library/react'; import React, { act } from 'react'; diff --git a/src/pages/user/register/index.tsx b/src/pages/user/register/index.tsx index b24d3023..33aab441 100644 --- a/src/pages/user/register/index.tsx +++ b/src/pages/user/register/index.tsx @@ -16,7 +16,7 @@ import type { FC } from 'react'; import { useEffect, useState } from 'react'; import type { StateType } from './service'; import { fakeRegister } from './service'; -import useStyles from './style.style'; +import useStyles from './styles'; const FormItem = Form.Item; const { Option } = Select; @@ -135,7 +135,9 @@ const Register: FC = () => { const value = form.getFieldValue('password'); const passwordStatus = getPasswordStatus(); return value?.length ? ( -
    +
    { - return { - main: { - width: '368px', - margin: '0 auto', - h3: { marginBottom: '20px', fontSize: '16px' }, - }, - password: { - marginBottom: '24px', - '.ant-form-item-explain': { display: 'none' }, - }, - getCaptcha: { - display: 'block', - width: '100%', - }, - - footer: { - width: '100%', - display: 'flex', - alignItems: 'center', - justifyContent: 'space-between', - }, - submit: { - width: '50%', - }, - success: { - transition: 'color 0.3s', - color: token.colorSuccess, - }, - warning: { - transition: 'color 0.3s', - color: token.colorWarning, - }, - error: { - transition: 'color 0.3s', - color: token.colorError, - }, - 'progress-pass > .progress': { - '.ant-progress-bg': { backgroundColor: token.colorWarning }, - }, - }; -}); - -export default useStyles; diff --git a/tsconfig.json b/tsconfig.json index 2dcc8d32..2fa95248 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,6 @@ "strict": true, "forceConsistentCasingInFileNames": true, "noImplicitReturns": true, - "suppressImplicitAnyIndexErrors": true, "declaration": true, "skipLibCheck": true, "resolveJsonModule": true,