chore: fix eslint warning and errors (#51920)

This commit is contained in:
afc163 2024-12-06 11:39:25 +08:00 committed by GitHub
parent 093c6c2d1f
commit cc67ee2009
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 2 deletions

View File

@ -102,7 +102,10 @@ const Group: React.FC<GroupProps> = (props) => {
); );
const childrenWithProps = toArray(children).map((child, index) => 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; const mergeCount = max?.count || maxCount;

View File

@ -199,6 +199,7 @@ const Breadcrumb = <T extends AnyObject = AnyObject>(props: BreadcrumbProps<T>)
const isLastItem = index === childrenLength - 1; const isLastItem = index === childrenLength - 1;
return cloneElement(element, { return cloneElement(element, {
separator: isLastItem ? '' : separator, separator: isLastItem ? '' : separator,
// eslint-disable-next-line react/no-array-index-key
key: index, key: index,
}); });
}); });

View File

@ -237,7 +237,7 @@
"eslint-plugin-compat": "^6.0.1", "eslint-plugin-compat": "^6.0.1",
"eslint-plugin-jest": "^28.8.3", "eslint-plugin-jest": "^28.8.3",
"eslint-plugin-jsx-a11y": "^6.10.0", "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", "eslint-plugin-react-refresh": "^0.4.13",
"fast-glob": "^3.3.2", "fast-glob": "^3.3.2",
"fetch-jsonp": "^1.3.0", "fetch-jsonp": "^1.3.0",

View File

@ -120,6 +120,7 @@ type Options = {
export default function accessibilityDemoTest(component: string, options: Options = {}) { export default function accessibilityDemoTest(component: string, options: Options = {}) {
// If skip is true, return immediately without executing any tests // If skip is true, return immediately without executing any tests
if (options.skip === true) { if (options.skip === true) {
// eslint-disable-next-line jest/no-disabled-tests
describe.skip(`${component} demo a11y`, () => { describe.skip(`${component} demo a11y`, () => {
it('skipped', () => {}); it('skipped', () => {});
}); });