From 87601689fadb04d79c356f82fc3523025b4e42dd Mon Sep 17 00:00:00 2001 From: thinkasany <480968828@qq.com> Date: Sun, 28 Sep 2025 11:55:43 +0800 Subject: [PATCH] chore: turn on unicorn/prefer-includes (#55169) --- .dumi/remarkAnchor.ts | 2 +- .dumi/theme/layouts/DocLayout/index.tsx | 5 +---- .dumi/theme/slots/Content/Contributors.tsx | 2 +- components/auto-complete/demo/non-case-sensitive.tsx | 2 +- components/cascader/demo/search.tsx | 4 +--- components/menu/demo/sider-current.tsx | 2 +- components/tag/demo/animation.tsx | 2 +- components/transfer/demo/component-token.tsx | 2 +- components/transfer/demo/search.tsx | 2 +- components/tree/demo/search.tsx | 2 +- eslint.config.mjs | 1 - 11 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.dumi/remarkAnchor.ts b/.dumi/remarkAnchor.ts index e339884bd8..14c93dd6c7 100644 --- a/.dumi/remarkAnchor.ts +++ b/.dumi/remarkAnchor.ts @@ -41,7 +41,7 @@ const remarkAnchor = (opt: Options = {}): UnifiedTransformer => { const ids = new Set(); unistUtilVisit.visit(tree, 'heading', (node) => { - if (toArr(realOpt.level).indexOf(node.depth) === -1) { + if (!toArr(realOpt.level).includes(node.depth)) { return unistUtilVisit.CONTINUE; } diff --git a/.dumi/theme/layouts/DocLayout/index.tsx b/.dumi/theme/layouts/DocLayout/index.tsx index 807ca9ba44..a79d6671f3 100644 --- a/.dumi/theme/layouts/DocLayout/index.tsx +++ b/.dumi/theme/layouts/DocLayout/index.tsx @@ -73,10 +73,7 @@ const DocLayout: React.FC = () => { }, [location]); const content = React.useMemo(() => { - if ( - ['', '/'].some((path) => path === pathname) || - ['/index'].some((path) => pathname.startsWith(path)) - ) { + if (['', '/'].includes(pathname) || ['/index'].some((path) => pathname.startsWith(path))) { return ( {outlet} diff --git a/.dumi/theme/slots/Content/Contributors.tsx b/.dumi/theme/slots/Content/Contributors.tsx index 669f6bbf7d..369c6c9797 100644 --- a/.dumi/theme/slots/Content/Contributors.tsx +++ b/.dumi/theme/slots/Content/Contributors.tsx @@ -58,7 +58,7 @@ const Contributors: React.FC = ({ filename }) => { owner="ant-design" fileName={filename} className={styles.list} - filter={(item) => !blockList.some((name) => name === item?.username?.toLowerCase())} + filter={(item) => !blockList.includes(item?.username?.toLowerCase() ?? '')} renderItem={(item, loading) => ( )} diff --git a/components/auto-complete/demo/non-case-sensitive.tsx b/components/auto-complete/demo/non-case-sensitive.tsx index 627cdaa100..582f7123a4 100644 --- a/components/auto-complete/demo/non-case-sensitive.tsx +++ b/components/auto-complete/demo/non-case-sensitive.tsx @@ -13,7 +13,7 @@ const App: React.FC = () => ( options={options} placeholder="try to type `b`" filterOption={(inputValue, option) => - option!.value.toUpperCase().indexOf(inputValue.toUpperCase()) !== -1 + option!.value.toUpperCase().includes(inputValue.toUpperCase()) } /> ); diff --git a/components/cascader/demo/search.tsx b/components/cascader/demo/search.tsx index 0494a021a3..96c57d5dc7 100644 --- a/components/cascader/demo/search.tsx +++ b/components/cascader/demo/search.tsx @@ -56,9 +56,7 @@ const onChange: CascaderProps