From cc67ee200953cbf07964a7118b2cf4d32df5ca13 Mon Sep 17 00:00:00 2001 From: afc163 Date: Fri, 6 Dec 2024 11:39:25 +0800 Subject: [PATCH] chore: fix eslint warning and errors (#51920) --- components/avatar/group.tsx | 5 ++++- components/breadcrumb/Breadcrumb.tsx | 1 + package.json | 2 +- tests/shared/accessibilityTest.tsx | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/avatar/group.tsx b/components/avatar/group.tsx index cccae8c40d..34fc2ee5ed 100644 --- a/components/avatar/group.tsx +++ b/components/avatar/group.tsx @@ -102,7 +102,10 @@ const Group: React.FC = (props) => { ); const childrenWithProps = toArray(children).map((child, index) => - cloneElement(child, { key: `avatar-key-${index}` }), + cloneElement(child, { + // eslint-disable-next-line react/no-array-index-key + key: `avatar-key-${index}`, + }), ); const mergeCount = max?.count || maxCount; diff --git a/components/breadcrumb/Breadcrumb.tsx b/components/breadcrumb/Breadcrumb.tsx index 049892e2a9..f23106db56 100755 --- a/components/breadcrumb/Breadcrumb.tsx +++ b/components/breadcrumb/Breadcrumb.tsx @@ -199,6 +199,7 @@ const Breadcrumb = (props: BreadcrumbProps) const isLastItem = index === childrenLength - 1; return cloneElement(element, { separator: isLastItem ? '' : separator, + // eslint-disable-next-line react/no-array-index-key key: index, }); }); diff --git a/package.json b/package.json index 352ff70d6b..23d3f0d22a 100644 --- a/package.json +++ b/package.json @@ -237,7 +237,7 @@ "eslint-plugin-compat": "^6.0.1", "eslint-plugin-jest": "^28.8.3", "eslint-plugin-jsx-a11y": "^6.10.0", - "eslint-plugin-react-hooks": "^5.0.0", + "eslint-plugin-react-hooks": "5.0.0", "eslint-plugin-react-refresh": "^0.4.13", "fast-glob": "^3.3.2", "fetch-jsonp": "^1.3.0", diff --git a/tests/shared/accessibilityTest.tsx b/tests/shared/accessibilityTest.tsx index 4df29d5045..6ab29067fb 100644 --- a/tests/shared/accessibilityTest.tsx +++ b/tests/shared/accessibilityTest.tsx @@ -120,6 +120,7 @@ type Options = { export default function accessibilityDemoTest(component: string, options: Options = {}) { // If skip is true, return immediately without executing any tests if (options.skip === true) { + // eslint-disable-next-line jest/no-disabled-tests describe.skip(`${component} demo a11y`, () => { it('skipped', () => {}); });