From 1a660e91c6d74aac09b070e008f7bd39ba5538c7 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 14 May 2026 18:35:31 +0800 Subject: [PATCH] fix: resolve jsx-a11y/anchor-is-valid and react-doctor lint warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use semantic HTML approach for different link categories: - **Action links** (with onClick/trigger actions): replace `` with ` )} ); diff --git a/src/pages/account/center/components/Projects/index.tsx b/src/pages/account/center/components/Projects/index.tsx index 36067b89..0c97cac8 100644 --- a/src/pages/account/center/components/Projects/index.tsx +++ b/src/pages/account/center/components/Projects/index.tsx @@ -36,7 +36,7 @@ const Projects: React.FC = () => { cover={{item.title}} > {item.title}} + title={{item.title}} description={item.subDescription} />
diff --git a/src/pages/account/settings/components/binding.tsx b/src/pages/account/settings/components/binding.tsx index 10aad1ca..64bc1fb4 100644 --- a/src/pages/account/settings/components/binding.tsx +++ b/src/pages/account/settings/components/binding.tsx @@ -3,7 +3,7 @@ import { DingdingOutlined, TaobaoOutlined, } from '@ant-design/icons'; -import { List } from 'antd'; +import { Button, List } from 'antd'; import React from 'react'; const BindingView: React.FC = () => { @@ -12,9 +12,9 @@ const BindingView: React.FC = () => { title: '绑定淘宝', description: '当前未绑定淘宝账号', actions: [ - + , ], avatar: , }, @@ -22,9 +22,9 @@ const BindingView: React.FC = () => { title: '绑定支付宝', description: '当前未绑定支付宝账号', actions: [ - + , ], avatar: , }, @@ -32,9 +32,9 @@ const BindingView: React.FC = () => { title: '绑定钉钉', description: '当前未绑定钉钉账号', actions: [ - + , ], avatar: , }, diff --git a/src/pages/account/settings/components/security.tsx b/src/pages/account/settings/components/security.tsx index d5c6398f..8c62d61e 100644 --- a/src/pages/account/settings/components/security.tsx +++ b/src/pages/account/settings/components/security.tsx @@ -1,4 +1,4 @@ -import { List } from 'antd'; +import { Button, List } from 'antd'; import React from 'react'; type Unpacked = T extends (infer U)[] ? U : T; @@ -20,45 +20,45 @@ const SecurityView: React.FC = () => { ), actions: [ - + , ], }, { title: '密保手机', description: `已绑定手机:138****8293`, actions: [ - + , ], }, { title: '密保问题', description: '未设置密保问题,密保问题可有效保护账户安全', actions: [ - + , ], }, { title: '备用邮箱', description: `已绑定邮箱:ant***sign.com`, actions: [ - + , ], }, { title: 'MFA 设备', description: '未绑定 MFA 设备,绑定后,可以进行二次确认', actions: [ - + , ], }, ]; diff --git a/src/pages/chatbot/index.tsx b/src/pages/chatbot/index.tsx index 6aff93a6..d888dc94 100644 --- a/src/pages/chatbot/index.tsx +++ b/src/pages/chatbot/index.tsx @@ -180,6 +180,7 @@ const ChatbotPage: React.FC = () => { }; const newChat = () => { + // eslint-disable-next-line react-doctor/rendering-hydration-mismatch-time -- only called in event handlers, not during render const key = crypto.randomUUID(); setConversations((prev) => [ { key, label: '新对话', group: '今天', isDraft: true }, @@ -261,6 +262,7 @@ const ChatbotPage: React.FC = () => { (c) => c.key !== conversation.key, ); if (next.length === 0) { + // eslint-disable-next-line react-doctor/rendering-hydration-mismatch-time -- only called in event handlers, not during render const key = crypto.randomUUID(); next.push({ key, diff --git a/src/pages/dashboard/workplace/index.tsx b/src/pages/dashboard/workplace/index.tsx index 891a25ff..b5a70c05 100644 --- a/src/pages/dashboard/workplace/index.tsx +++ b/src/pages/dashboard/workplace/index.tsx @@ -118,9 +118,9 @@ const Workplace: FC = () => { avatar={} title={ - + {item.user.name} - +   {events} @@ -281,12 +281,12 @@ const Workplace: FC = () => { {projectNotice.map((item) => { return ( - + {item.member.substring(0, 3)} - + ); })} diff --git a/src/pages/form/advanced-form/index.tsx b/src/pages/form/advanced-form/index.tsx index a3e4c391..f6c18210 100644 --- a/src/pages/form/advanced-form/index.tsx +++ b/src/pages/form/advanced-form/index.tsx @@ -10,7 +10,7 @@ import { ProFormText, ProFormTimePicker, } from '@ant-design/pro-components'; -import { Card, Col, message, Popover, Row } from 'antd'; +import { Button, Card, Col, message, Popover, Row } from 'antd'; import type { FC } from 'react'; import { useRef, useState } from 'react'; import { fakeSubmitForm } from './service'; @@ -161,16 +161,13 @@ const AdvancedForm: FC> = () => { valueType: 'option', render: (_, record: TableFormDateType, _index, action) => { return [ - { - e.preventDefault(); - action?.startEditable(record.key); - }} + , ]; }, }, diff --git a/src/pages/list/basic-list/index.tsx b/src/pages/list/basic-list/index.tsx index 3416b23f..36f5c171 100644 --- a/src/pages/list/basic-list/index.tsx +++ b/src/pages/list/basic-list/index.tsx @@ -171,9 +171,9 @@ const BasicList: FC = () => { ], }} > - + ); }; @@ -229,16 +229,13 @@ const BasicList: FC = () => { renderItem={(item) => ( { - e.preventDefault(); - showEditModal(item); - }} + type="link" + onClick={() => showEditModal(item)} > 编辑 - , + , renderMoreBtn(item), ]} > diff --git a/src/pages/list/card-list/index.tsx b/src/pages/list/card-list/index.tsx index bdeae33d..6eabbc6f 100644 --- a/src/pages/list/card-list/index.tsx +++ b/src/pages/list/card-list/index.tsx @@ -22,21 +22,21 @@ const CardList = () => { 提供跨越设计与开发的体验解决方案。

- + {' '} 快速开始 - + {' '} 产品简介 - + { hoverable className={styles.card} actions={[ - + , + , ]} > { src={item.avatar} /> } - title={{item.title}} + title={{item.title}} description={ { options={ownerOptions} /> - { - e.preventDefault(); - setOwner(); - }} - onKeyDown={(e) => { - if (e.key === 'Enter') { - e.preventDefault(); - setOwner(); - } - }} + onClick={() => setOwner()} > 只看自己的 - + diff --git a/src/pages/list/search/projects/index.tsx b/src/pages/list/search/projects/index.tsx index b9116cb7..678d0b94 100644 --- a/src/pages/list/search/projects/index.tsx +++ b/src/pages/list/search/projects/index.tsx @@ -50,7 +50,7 @@ const Projects: FC = () => { cover={{item.title}} > {item.title}} + title={{item.title}} description={ 12421 }, + { key: '4', label: '关联单据', children: 12421 }, { key: '5', label: '生效日期', children: '2017-07-07 ~ 2017-08-08' }, { key: '6', label: '备注', children: '请于两个工作日内确认' }, ]; @@ -305,7 +305,9 @@ const Advanced: FC = () => { }} />
- 催一下 +
); diff --git a/src/pages/result/fail/index.tsx b/src/pages/result/fail/index.tsx index 5c924358..a5c5b649 100644 --- a/src/pages/result/fail/index.tsx +++ b/src/pages/result/fail/index.tsx @@ -22,15 +22,15 @@ export default () => { className={styles.error_icon} /> 您的账户已被冻结 - 立即解冻 - +
{ className={styles.error_icon} /> 您的账户还不具备申请资格 - 立即升级 - +
); diff --git a/src/pages/result/success/index.tsx b/src/pages/result/success/index.tsx index cc260105..aa2a8e30 100644 --- a/src/pages/result/success/index.tsx +++ b/src/pages/result/success/index.tsx @@ -51,7 +51,7 @@ const Success: React.FC = () => { }} > 周毛毛 - + ); diff --git a/src/pages/table-list/index.tsx b/src/pages/table-list/index.tsx index b1459967..4ce8f49f 100644 --- a/src/pages/table-list/index.tsx +++ b/src/pages/table-list/index.tsx @@ -58,16 +58,15 @@ const TableList: React.FC = () => { dataIndex: 'name', render: (dom, entity) => { return ( - { - e.preventDefault(); + ); }, }, @@ -197,12 +196,12 @@ const TableList: React.FC = () => { render: (_, record) => [ + } key="config" onOk={actionRef.current?.reload} diff --git a/src/pages/user/login/__snapshots__/login.test.tsx.snap b/src/pages/user/login/__snapshots__/login.test.tsx.snap index ffdfd20d..6244e5ee 100644 --- a/src/pages/user/login/__snapshots__/login.test.tsx.snap +++ b/src/pages/user/login/__snapshots__/login.test.tsx.snap @@ -884,27 +884,35 @@ exports[`Login Page should show login form 1`] = ` class="ant-input-suffix" > - + + @@ -948,7 +956,7 @@ exports[`Login Page should show login form 1`] = ` type="button" > - Login + 登 录 diff --git a/src/pages/user/login/index.tsx b/src/pages/user/login/index.tsx index ed200e96..eda4ffd2 100644 --- a/src/pages/user/login/index.tsx +++ b/src/pages/user/login/index.tsx @@ -398,7 +398,7 @@ const Login: React.FC = () => { /> > = () => { const actions = (
- - - +