diff --git a/.dumi/hooks/use.ts b/.dumi/hooks/use.ts index 2502dcd1fa..2e9bc4a0c6 100644 --- a/.dumi/hooks/use.ts +++ b/.dumi/hooks/use.ts @@ -9,22 +9,22 @@ function use(promise: PromiseLike): T { } if (internal.status === 'rejected') { throw internal.reason; - } else if (internal.status === 'pending') { - throw internal; - } else { - internal.status = 'pending'; - internal.then( - (result) => { - internal.status = 'fulfilled'; - internal.value = result; - }, - (reason) => { - internal.status = 'rejected'; - internal.reason = reason; - }, - ); + } + if (internal.status === 'pending') { throw internal; } + internal.status = 'pending'; + internal.then( + (result) => { + internal.status = 'fulfilled'; + internal.value = result; + }, + (reason) => { + internal.status = 'rejected'; + internal.reason = reason; + }, + ); + throw internal; } export default use; diff --git a/.dumi/hooks/useFetch/index.ts b/.dumi/hooks/useFetch/index.ts index 99aa763ab3..d020df56a9 100644 --- a/.dumi/hooks/useFetch/index.ts +++ b/.dumi/hooks/useFetch/index.ts @@ -1,4 +1,5 @@ import fetch from 'cross-fetch'; + import use from '../use'; import FetchCache from './cache'; diff --git a/.dumi/hooks/useLocation.ts b/.dumi/hooks/useLocation.ts index 3499a3bbe2..0c5d2e7344 100644 --- a/.dumi/hooks/useLocation.ts +++ b/.dumi/hooks/useLocation.ts @@ -1,5 +1,6 @@ -import { useLocation as useDumiLocation } from 'dumi'; import * as React from 'react'; +import { useLocation as useDumiLocation } from 'dumi'; + import useLocale from './useLocale'; function clearPath(path: string) { diff --git a/.dumi/pages/404/index.tsx b/.dumi/pages/404/index.tsx index 1960a76f29..15229c04c8 100644 --- a/.dumi/pages/404/index.tsx +++ b/.dumi/pages/404/index.tsx @@ -1,9 +1,10 @@ -import { HomeOutlined } from '@ant-design/icons'; -import { useLocation } from 'dumi'; import React, { useEffect } from 'react'; +import { HomeOutlined } from '@ant-design/icons'; import { Button, Result } from 'antd'; -import * as utils from '../../theme/utils'; +import { useLocation } from 'dumi'; + import Link from '../../theme/common/Link'; +import * as utils from '../../theme/utils'; export interface NotFoundProps { router: { diff --git a/.dumi/pages/index/components/DesignFramework.tsx b/.dumi/pages/index/components/DesignFramework.tsx index 618b51be13..8d57a46891 100644 --- a/.dumi/pages/index/components/DesignFramework.tsx +++ b/.dumi/pages/index/components/DesignFramework.tsx @@ -5,9 +5,9 @@ import { useLocation } from 'dumi'; import useDark from '../../../hooks/useDark'; import useLocale from '../../../hooks/useLocale'; +import Link from '../../../theme/common/Link'; import SiteContext from '../../../theme/slots/SiteContext'; import * as utils from '../../../theme/utils'; -import Link from '../../../theme/common/Link'; const SECONDARY_LIST = [ { diff --git a/.dumi/pages/index/components/PreviewBanner/index.tsx b/.dumi/pages/index/components/PreviewBanner/index.tsx index 2afbfae679..86608c5fe3 100644 --- a/.dumi/pages/index/components/PreviewBanner/index.tsx +++ b/.dumi/pages/index/components/PreviewBanner/index.tsx @@ -4,9 +4,9 @@ import { createStyles } from 'antd-style'; import { useLocation } from 'dumi'; import useLocale from '../../../../hooks/useLocale'; +import Link from '../../../../theme/common/Link'; import SiteContext from '../../../../theme/slots/SiteContext'; import * as utils from '../../../../theme/utils'; -import Link from '../../../../theme/common/Link'; import GroupMaskLayer from '../GroupMaskLayer'; const ComponentsBlock = React.lazy(() => import('./ComponentsBlock')); diff --git a/.dumi/pages/index/index.tsx b/.dumi/pages/index/index.tsx index a528f4347e..8def1ca0ba 100644 --- a/.dumi/pages/index/index.tsx +++ b/.dumi/pages/index/index.tsx @@ -5,8 +5,8 @@ import { createStyles, css } from 'antd-style'; import useDark from '../../hooks/useDark'; import useLocale from '../../hooks/useLocale'; import BannerRecommends from './components/BannerRecommends'; -import PreviewBanner from './components/PreviewBanner'; import Group from './components/Group'; +import PreviewBanner from './components/PreviewBanner'; const ComponentsList = React.lazy(() => import('./components/ComponentsList')); const DesignFramework = React.lazy(() => import('./components/DesignFramework')); diff --git a/.dumi/rehypeAntd.ts b/.dumi/rehypeAntd.ts index 1cecbf93d3..2bb50bb7bf 100644 --- a/.dumi/rehypeAntd.ts +++ b/.dumi/rehypeAntd.ts @@ -74,7 +74,7 @@ function rehypeAntd(): UnifiedTransformer { const code = (node.children[0] as any).value as string; const configRegx = /^const sandpackConfig = ([\S\s]*?});/; const [configString] = code.match(configRegx) || []; - // eslint-disable-next-line no-eval + /* biome-ignore lint/security/noGlobalEval: used in documentation */ /* eslint-disable-next-line no-eval */ const config = configString && eval(`(${configString.replace(configRegx, '$1')})`); Object.keys(config || {}).forEach((key) => { if (typeof config[key] === 'object') { diff --git a/.dumi/theme/builtins/IconSearch/IconSearch.tsx b/.dumi/theme/builtins/IconSearch/IconSearch.tsx index 64e5df813e..4857172ad9 100644 --- a/.dumi/theme/builtins/IconSearch/IconSearch.tsx +++ b/.dumi/theme/builtins/IconSearch/IconSearch.tsx @@ -81,7 +81,7 @@ const IconSearch: React.FC = () => { if (searchKey) { const matchKey = searchKey // eslint-disable-next-line prefer-regex-literals - .replace(new RegExp(`^<([a-zA-Z]*)\\s/>$`, 'gi'), (_, name) => name) + .replace(/^<([a-z]*)\s\/>$/gi, (_, name) => name) .replace(/(Filled|Outlined|TwoTone)$/, '') .toLowerCase(); iconList = iconList.filter((iconName) => iconName.toLowerCase().includes(matchKey)); diff --git a/.dumi/theme/builtins/IconSearch/themeIcons.tsx b/.dumi/theme/builtins/IconSearch/themeIcons.tsx index 892a95dd29..bea1ef7509 100644 --- a/.dumi/theme/builtins/IconSearch/themeIcons.tsx +++ b/.dumi/theme/builtins/IconSearch/themeIcons.tsx @@ -12,6 +12,7 @@ export const FilledIcon: CustomIconComponent = (props) => { '0c0-53-43-96-96-96z'; return ( + Filled Icon ); @@ -26,6 +27,7 @@ export const OutlinedIcon: CustomIconComponent = (props) => { ' 12 12v680c0 6.6-5.4 12-12 12z'; return ( + Outlined Icon ); @@ -39,6 +41,7 @@ export const TwoToneIcon: CustomIconComponent = (props) => { '68 368 0 203.41-164.622 368-368 368z'; return ( + TwoTone Icon ); diff --git a/.dumi/theme/builtins/ImagePreview/index.tsx b/.dumi/theme/builtins/ImagePreview/index.tsx index a504bf0164..7fe41f0af4 100644 --- a/.dumi/theme/builtins/ImagePreview/index.tsx +++ b/.dumi/theme/builtins/ImagePreview/index.tsx @@ -117,6 +117,7 @@ const ImagePreview: React.FC> = (prop
{coverMeta.alt}
diff --git a/.dumi/theme/builtins/InlinePopover/index.tsx b/.dumi/theme/builtins/InlinePopover/index.tsx index 2621eb0d2d..74852b02e5 100644 --- a/.dumi/theme/builtins/InlinePopover/index.tsx +++ b/.dumi/theme/builtins/InlinePopover/index.tsx @@ -1,6 +1,7 @@ -import { PictureOutlined } from '@ant-design/icons'; import React from 'react'; +import { PictureOutlined } from '@ant-design/icons'; import { Image, Tooltip, Typography } from 'antd'; + import useLocale from '../../../hooks/useLocale'; const locales = { diff --git a/.dumi/theme/builtins/InstallDependencies/index.tsx b/.dumi/theme/builtins/InstallDependencies/index.tsx index d1cd32a845..36bcd4dcc3 100644 --- a/.dumi/theme/builtins/InstallDependencies/index.tsx +++ b/.dumi/theme/builtins/InstallDependencies/index.tsx @@ -3,10 +3,10 @@ import { ConfigProvider, Tabs } from 'antd'; import SourceCode from 'dumi/theme-default/builtins/SourceCode'; import type { Tab } from 'rc-tabs/lib/interface'; +import BunLogo from './bun'; import NpmLogo from './npm'; import PnpmLogo from './pnpm'; import YarnLogo from './yarn'; -import BunLogo from './bun'; interface InstallProps { npm?: string; diff --git a/.dumi/theme/builtins/InstallDependencies/npm.tsx b/.dumi/theme/builtins/InstallDependencies/npm.tsx index 63937b0322..923e18e710 100644 --- a/.dumi/theme/builtins/InstallDependencies/npm.tsx +++ b/.dumi/theme/builtins/InstallDependencies/npm.tsx @@ -31,6 +31,7 @@ const NpmIcon: React.FC = (props) => { viewBox="0 0 16 16" width="1em" > + npm icon diff --git a/.dumi/theme/builtins/InstallDependencies/pnpm.tsx b/.dumi/theme/builtins/InstallDependencies/pnpm.tsx index 67cb132e2e..ea8fd55de8 100644 --- a/.dumi/theme/builtins/InstallDependencies/pnpm.tsx +++ b/.dumi/theme/builtins/InstallDependencies/pnpm.tsx @@ -33,6 +33,7 @@ const PnpmIcon: React.FC = (props) => { viewBox="0 0 24 24" width="1em" > + pnpm icon diff --git a/.dumi/theme/builtins/InstallDependencies/yarn.tsx b/.dumi/theme/builtins/InstallDependencies/yarn.tsx index 7f73b97efd..e4ffa35142 100644 --- a/.dumi/theme/builtins/InstallDependencies/yarn.tsx +++ b/.dumi/theme/builtins/InstallDependencies/yarn.tsx @@ -32,6 +32,7 @@ const YarnIcon: React.FC = (props) => { viewBox="0 0 496 512" width="1em" > + yarn icon diff --git a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx index 22e2ef7774..44c4d169bb 100644 --- a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx @@ -401,6 +401,7 @@ createRoot(document.getElementById('container')).render(); {description && (
)} diff --git a/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx b/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx index b931d48077..0edc3e9600 100644 --- a/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/DesignPreviewer.tsx @@ -80,6 +80,7 @@ const DesignPreviewer: FC = ({ children, title, description, {title} {description && ( + // biome-ignore lint/security/noDangerouslySetInnerHtml: description is from markdown
)}
@@ -89,10 +90,10 @@ const DesignPreviewer: FC = ({ children, title, description, 已复制,使用 Kitchen 插件即可粘贴
) : ( -
+
+ )}
diff --git a/.dumi/theme/builtins/ResourceCards/index.tsx b/.dumi/theme/builtins/ResourceCards/index.tsx index c025809194..85ff0621d9 100644 --- a/.dumi/theme/builtins/ResourceCards/index.tsx +++ b/.dumi/theme/builtins/ResourceCards/index.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { ExclamationCircleOutlined } from '@ant-design/icons'; -import { Col, Row, Tooltip, Card, Typography } from 'antd'; +import { Card, Col, Row, Tooltip, Typography } from 'antd'; import { createStyles } from 'antd-style'; + import useLocale from '../../../hooks/useLocale'; const { Paragraph } = Typography; @@ -22,19 +23,19 @@ const useStyle = createStyles(({ token, css }) => ({ transform: scale(1.3); `, badge: css` - position: absolute; - top: 8px; - right: 8px; - padding: ${token.paddingXXS}px ${token.paddingXS}px; - color: #fff; - font-size: ${token.fontSizeSM}px; - line-height: 1; - background: rgba(0, 0, 0, 0.65); - border-radius: ${token.borderRadiusLG}px; - box-shadow: 0 0 2px rgba(255, 255, 255, 0.2); - display: inline-flex; - column-gap: ${token.paddingXXS}px; - `, + position: absolute; + top: 8px; + right: 8px; + padding: ${token.paddingXXS}px ${token.paddingXS}px; + color: #fff; + font-size: ${token.fontSizeSM}px; + line-height: 1; + background: rgba(0, 0, 0, 0.65); + border-radius: ${token.borderRadiusLG}px; + box-shadow: 0 0 2px rgba(255, 255, 255, 0.2); + display: inline-flex; + column-gap: ${token.paddingXXS}px; + `, })); export type Resource = { diff --git a/.dumi/theme/common/CodePenIcon.tsx b/.dumi/theme/common/CodePenIcon.tsx index 63ecd3d366..bf2e8f1f9c 100644 --- a/.dumi/theme/common/CodePenIcon.tsx +++ b/.dumi/theme/common/CodePenIcon.tsx @@ -3,6 +3,7 @@ import Icon from '@ant-design/icons'; const SVGIcon: React.FC = () => ( + codepen icon ); diff --git a/.dumi/theme/common/CodePreview.tsx b/.dumi/theme/common/CodePreview.tsx index 35f8a0dc79..c1e14d9f7e 100644 --- a/.dumi/theme/common/CodePreview.tsx +++ b/.dumi/theme/common/CodePreview.tsx @@ -79,6 +79,7 @@ function toReactComponent(jsonML: any[]) { const attr = JsonML.getAttributes(node); return (
+            {/* biome-ignore lint/security/noDangerouslySetInnerHtml: it's for markdown */}
             
           
); diff --git a/.dumi/theme/common/CodeSandboxIcon.tsx b/.dumi/theme/common/CodeSandboxIcon.tsx index 24162f03be..3b2f9ad4dc 100644 --- a/.dumi/theme/common/CodeSandboxIcon.tsx +++ b/.dumi/theme/common/CodeSandboxIcon.tsx @@ -3,6 +3,7 @@ import Icon from '@ant-design/icons'; const SVGIcon: React.FC = () => ( + CodeSandbox Icon ); diff --git a/.dumi/theme/common/Color/ColorBlock.tsx b/.dumi/theme/common/Color/ColorBlock.tsx index b964285129..3d3dfd4167 100644 --- a/.dumi/theme/common/Color/ColorBlock.tsx +++ b/.dumi/theme/common/Color/ColorBlock.tsx @@ -1,6 +1,6 @@ import React, { useMemo } from 'react'; -import CopyToClipboard from 'react-copy-to-clipboard'; import { message } from 'antd'; +import CopyToClipboard from 'react-copy-to-clipboard'; interface ColorBlockProps { color: string; diff --git a/.dumi/theme/common/Color/ColorPaletteToolDark.tsx b/.dumi/theme/common/Color/ColorPaletteToolDark.tsx index c7f3da669f..b8ba35f27d 100644 --- a/.dumi/theme/common/Color/ColorPaletteToolDark.tsx +++ b/.dumi/theme/common/Color/ColorPaletteToolDark.tsx @@ -1,8 +1,9 @@ -import { FormattedMessage } from 'dumi'; import React, { useMemo, useState } from 'react'; import { Col, ColorPicker, Row } from 'antd'; -import ColorPatterns from './ColorPatterns'; +import { FormattedMessage } from 'dumi'; + import useLocale from '../../../hooks/useLocale'; +import ColorPatterns from './ColorPatterns'; const primaryMinSaturation = 70; // 主色推荐最小饱和度 const primaryMinBrightness = 70; // 主色推荐最小亮度 diff --git a/.dumi/theme/common/Color/ColorPalettes.tsx b/.dumi/theme/common/Color/ColorPalettes.tsx index 2c4bd1729c..eb69f5f89c 100644 --- a/.dumi/theme/common/Color/ColorPalettes.tsx +++ b/.dumi/theme/common/Color/ColorPalettes.tsx @@ -1,5 +1,6 @@ -import classNames from 'classnames'; import React from 'react'; +import classNames from 'classnames'; + import Palette from './Palette'; const colors = [ diff --git a/.dumi/theme/common/Color/ColorPatterns.tsx b/.dumi/theme/common/Color/ColorPatterns.tsx index 080b5651ce..db677b275a 100644 --- a/.dumi/theme/common/Color/ColorPatterns.tsx +++ b/.dumi/theme/common/Color/ColorPatterns.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { generate } from '@ant-design/colors'; import uniq from 'lodash/uniq'; + import ColorBlock from './ColorBlock'; interface ColorPatternsProps { diff --git a/.dumi/theme/common/Color/ColorStyle.tsx b/.dumi/theme/common/Color/ColorStyle.tsx index d37cfdfdab..36971dcc56 100644 --- a/.dumi/theme/common/Color/ColorStyle.tsx +++ b/.dumi/theme/common/Color/ColorStyle.tsx @@ -21,7 +21,7 @@ const gray: { [key: number]: string } = { const ColorStyle: React.FC = () => { const token = useTheme(); - const makePalette = (color: string, index: number = 1): string => { + const makePalette = (color: string, index = 1): string => { if (index <= 10) { return ` .palette-${color}-${index} { @@ -33,7 +33,7 @@ ${makePalette(color, index + 1)} return ''; }; - const makeGrayPalette = (index: number = 1): string => { + const makeGrayPalette = (index = 1): string => { if (index <= 13) { return ` .palette-gray-${index} { diff --git a/.dumi/theme/common/ComponentChangelog/index.tsx b/.dumi/theme/common/ComponentChangelog/index.tsx index cbaae2977d..1c8117f1a8 100644 --- a/.dumi/theme/common/ComponentChangelog/index.tsx +++ b/.dumi/theme/common/ComponentChangelog/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import type { ComponentChangelogProps } from './ComponentChangelog'; import ComponentChangelog from './ComponentChangelog'; diff --git a/.dumi/theme/common/DirectionIcon.tsx b/.dumi/theme/common/DirectionIcon.tsx index a751f98f17..1a58d8fec9 100644 --- a/.dumi/theme/common/DirectionIcon.tsx +++ b/.dumi/theme/common/DirectionIcon.tsx @@ -15,6 +15,7 @@ const DirectionSvg: React.FC = ({ direction }) => ( fill="currentColor" style={{ transform: `scaleX(${direction === 'ltr' ? '1' : '-1'})` }} > + Direction Icon ); diff --git a/.dumi/theme/common/ExternalLinkIcon.tsx b/.dumi/theme/common/ExternalLinkIcon.tsx index f193d6a695..ba6587d991 100644 --- a/.dumi/theme/common/ExternalLinkIcon.tsx +++ b/.dumi/theme/common/ExternalLinkIcon.tsx @@ -3,6 +3,7 @@ import Icon from '@ant-design/icons'; const SVGIcon: React.FC<{ color?: string }> = ({ color = 'currentColor' }) => ( + External Link Icon diff --git a/.dumi/theme/common/Link.tsx b/.dumi/theme/common/Link.tsx index d511410fce..272d84e4b3 100644 --- a/.dumi/theme/common/Link.tsx +++ b/.dumi/theme/common/Link.tsx @@ -1,6 +1,6 @@ import type { MouseEvent, MouseEventHandler } from 'react'; import React, { forwardRef, useLayoutEffect, useTransition } from 'react'; -import { useLocation, useNavigate, Link as DumiLink } from 'dumi'; +import { Link as DumiLink, useLocation, useNavigate } from 'dumi'; import nprogress from 'nprogress'; export interface LinkProps { diff --git a/.dumi/theme/common/RiddleIcon.tsx b/.dumi/theme/common/RiddleIcon.tsx index 2c46a24152..e08b49ec6d 100644 --- a/.dumi/theme/common/RiddleIcon.tsx +++ b/.dumi/theme/common/RiddleIcon.tsx @@ -3,6 +3,7 @@ import Icon from '@ant-design/icons'; const SVGIcon: React.FC = () => ( + Riddle logo ); diff --git a/.dumi/theme/common/ThemeSwitch/ThemeIcon.tsx b/.dumi/theme/common/ThemeSwitch/ThemeIcon.tsx index be4339f326..e1dda2f636 100644 --- a/.dumi/theme/common/ThemeSwitch/ThemeIcon.tsx +++ b/.dumi/theme/common/ThemeSwitch/ThemeIcon.tsx @@ -5,6 +5,7 @@ const ThemeIcon: React.FC<{ className?: string }> = (props) => { const SVGIcon = React.useCallback( () => ( + Theme icon diff --git a/.dumi/theme/common/styles/Reset.tsx b/.dumi/theme/common/styles/Reset.tsx index de14849a74..c746a9ac36 100644 --- a/.dumi/theme/common/styles/Reset.tsx +++ b/.dumi/theme/common/styles/Reset.tsx @@ -1,5 +1,5 @@ -import { css, Global } from '@emotion/react'; import React from 'react'; +import { css, Global } from '@emotion/react'; import { useTheme } from 'antd-style'; export default () => { @@ -11,7 +11,8 @@ export default () => { @font-face { font-weight: normal; font-family: AlibabaPuHuiTi; - src: url('//at.alicdn.com/t/webfont_6e11e43nfj.woff2') format('woff2'), + src: + url('//at.alicdn.com/t/webfont_6e11e43nfj.woff2') format('woff2'), url('//at.alicdn.com/t/webfont_6e11e43nfj.woff') format('woff'), /* chrome、firefox */ url('//at.alicdn.com/t/webfont_6e11e43nfj.ttf') format('truetype'); /* chrome、firefox、opera、Safari, Android, iOS 4.2+ */ font-display: swap; @@ -20,7 +21,8 @@ export default () => { @font-face { font-weight: bold; font-family: AlibabaPuHuiTi; - src: url('//at.alicdn.com/t/webfont_exesdog9toj.woff2') format('woff2'), + src: + url('//at.alicdn.com/t/webfont_exesdog9toj.woff2') format('woff2'), url('//at.alicdn.com/t/webfont_exesdog9toj.woff') format('woff'), /* chrome、firefox */ url('//at.alicdn.com/t/webfont_exesdog9toj.ttf') format('truetype'); /* chrome、firefox、opera、Safari, Android, iOS 4.2+ */ @@ -32,7 +34,8 @@ export default () => { @font-face { font-weight: 900; font-family: 'AliPuHui'; - src: url('//at.alicdn.com/wf/webfont/exMpJIukiCms/Gsw2PSKrftc1yNWMNlXgw.woff2') + src: + url('//at.alicdn.com/wf/webfont/exMpJIukiCms/Gsw2PSKrftc1yNWMNlXgw.woff2') format('woff2'), url('//at.alicdn.com/wf/webfont/exMpJIukiCms/vtu73by4O2gEBcvBuLgeu.woff') format('woff'); font-display: swap; diff --git a/.dumi/theme/layouts/GlobalLayout.tsx b/.dumi/theme/layouts/GlobalLayout.tsx index ab1ab33f28..dc9ef040d5 100644 --- a/.dumi/theme/layouts/GlobalLayout.tsx +++ b/.dumi/theme/layouts/GlobalLayout.tsx @@ -153,6 +153,7 @@ const GlobalLayout: React.FC = () => { plain: true, types: 'style', }); + // biome-ignore lint/security/noDangerouslySetInnerHtml: only used in .dumi return ; }); @@ -166,6 +167,7 @@ const GlobalLayout: React.FC = () => { data-type="antd-css-var" data-rc-order="prepend" data-rc-priority="-9999" + // biome-ignore lint/security/noDangerouslySetInnerHtml: only used in .dumi dangerouslySetInnerHTML={{ __html: styleText }} /> ); @@ -175,6 +177,7 @@ const GlobalLayout: React.FC = () => { )); diff --git a/.dumi/theme/layouts/ResourceLayout/index.tsx b/.dumi/theme/layouts/ResourceLayout/index.tsx index cce1351f26..93d0fd20b2 100644 --- a/.dumi/theme/layouts/ResourceLayout/index.tsx +++ b/.dumi/theme/layouts/ResourceLayout/index.tsx @@ -10,7 +10,7 @@ import EditButton from '../../common/EditButton'; import Footer from '../../slots/Footer'; import AffixTabs from './AffixTabs'; -export type ResourceLayoutProps = PropsWithChildren<{}>; +export type ResourceLayoutProps = PropsWithChildren>; const resourcePadding = 40; const articleMaxWidth = 1208; diff --git a/.dumi/theme/slots/Content/JuejinLogo.tsx b/.dumi/theme/slots/Content/JuejinLogo.tsx index 652aad3a95..fc6ee7fc8c 100644 --- a/.dumi/theme/slots/Content/JuejinLogo.tsx +++ b/.dumi/theme/slots/Content/JuejinLogo.tsx @@ -17,6 +17,7 @@ const JuejinLogo: React.FC = (props) => { viewBox="0 0 36 28" fill="none" > + Juejin logo { const { headerHeight, colorTextHeading, fontFamily, mobileMaxWidth } = token; diff --git a/.dumi/theme/slots/Header/SwitchBtn.tsx b/.dumi/theme/slots/Header/SwitchBtn.tsx index 06a651387a..49a96e0376 100644 --- a/.dumi/theme/slots/Header/SwitchBtn.tsx +++ b/.dumi/theme/slots/Header/SwitchBtn.tsx @@ -11,7 +11,7 @@ export interface LangBtnProps { value: 1 | 2; pure?: boolean; onClick?: React.MouseEventHandler; - ['aria-label']?: string; + 'aria-label'?: string; } const BASE_SIZE = '1.2em'; @@ -95,7 +95,13 @@ const LangBtn: React.FC = (props) => { } = useStyle(); const node = ( -
{pure && (value === 1 ? label1 : label2)} {!pure && ( diff --git a/.dumi/theme/slots/SiteContext.ts b/.dumi/theme/slots/SiteContext.ts index 6b29b00ea3..40c10f3d95 100644 --- a/.dumi/theme/slots/SiteContext.ts +++ b/.dumi/theme/slots/SiteContext.ts @@ -1,5 +1,6 @@ import * as React from 'react'; import type { DirectionType } from 'antd/es/config-provider'; + import type { ThemeName } from '../common/ThemeSwitch'; export interface SiteContextProps { diff --git a/.dumirc.ts b/.dumirc.ts index 49c41d2ebe..1e62c92a3a 100644 --- a/.dumirc.ts +++ b/.dumirc.ts @@ -11,7 +11,7 @@ export default defineConfig({ manifest: {}, conventionRoutes: { // to avoid generate routes for .dumi/pages/index/components/xx - exclude: [new RegExp('index/components/')], + exclude: [/index\/components\//], }, ssr: process.env.NODE_ENV === 'production' ? {} : false, hash: true, diff --git a/.lintstagedrc.json b/.lintstagedrc.json new file mode 100644 index 0000000000..548eeec29d --- /dev/null +++ b/.lintstagedrc.json @@ -0,0 +1,4 @@ +{ + "*.{ts,tsx,js,jsx,json,css}": ["biome check --write"], + "*.{md,yml}": ["prettier --ignore-unknown --write"] +} diff --git a/.prettierignore b/.prettierignore index dd7814aa61..d76dd4bc2b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -5,13 +5,13 @@ CODEOWNERS Dockerfile.ui-test .dumi/tmp .dumi/tmp-production +!dumi AUTHORS.txt lib/ es/ dist/ _site/ server -.dumi/tmp coverage/ CNAME LICENSE @@ -30,4 +30,4 @@ components/*/*.jsx .eslintignore .history **/*.yml -*.html \ No newline at end of file +*.html diff --git a/.stylelintrc.js b/.stylelintrc.js deleted file mode 100644 index 1deae3c701..0000000000 --- a/.stylelintrc.js +++ /dev/null @@ -1,42 +0,0 @@ -module.exports = { - extends: [ - 'stylelint-config-standard', - 'stylelint-prettier/recommended', - 'stylelint-config-rational-order', - ], - // 使用 stylelint 来 lint css in js? https://github.com/emotion-js/emotion/discussions/2694 - rules: { - 'function-name-case': ['lower'], - 'function-no-unknown': [ - true, - { - ignoreFunctions: [ - 'fade', - 'fadeout', - 'tint', - 'darken', - 'ceil', - 'fadein', - 'floor', - 'unit', - 'shade', - 'lighten', - 'percentage', - '-', - ], - }, - ], - 'import-notation': null, - 'no-descending-specificity': null, - 'no-invalid-position-at-import-rule': null, - 'declaration-empty-line-before': null, - 'keyframes-name-pattern': null, - 'custom-property-pattern': null, - 'number-max-precision': 8, - 'alpha-value-notation': 'number', - 'color-function-notation': 'legacy', - 'selector-class-pattern': null, - 'selector-id-pattern': null, - 'selector-not-notation': null, - }, -}; diff --git a/README.md b/README.md index d916f8a402..f08eb4ed7e 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,11 @@ An enterprise-class UI design language and React UI library. -[![CI status][github-action-image]][github-action-url] -[![codecov][codecov-image]][codecov-url] -[![NPM version][npm-image]][npm-url] -[![NPM downloads][download-image]][download-url] +[![CI status][github-action-image]][github-action-url] [![codecov][codecov-image]][codecov-url] [![NPM version][npm-image]][npm-url] [![NPM downloads][download-image]][download-url] -[![][bundlephobia-image]][bundlephobia-url] -[![][bundlesize-js-image]][unpkg-js-url] -[![FOSSA Status][fossa-image]][fossa-url] +[![][bundlephobia-image]][bundlephobia-url] [![][bundlesize-js-image]][unpkg-js-url] [![FOSSA Status][fossa-image]][fossa-url] -[![Follow Twitter][twitter-image]][twitter-url] -[![Renovate status][renovate-image]][renovate-dashboard-url] -[![][issues-helper-image]][issues-helper-url] -[![dumi][dumi-image]][dumi-url] -[![Issues need help][help-wanted-image]][help-wanted-url] +[![Follow Twitter][twitter-image]][twitter-url] [![Renovate status][renovate-image]][renovate-dashboard-url] [![][issues-helper-image]][issues-helper-url] [![dumi][dumi-image]][dumi-url] [![Issues need help][help-wanted-image]][help-wanted-url] [Changelog](./CHANGELOG.en-US.md) · [Report Bug][github-issues-url] · [Request Feature][github-issues-url] · English · [中文](./README-zh_CN.md) @@ -50,6 +41,7 @@ An enterprise-class UI design language and React UI library. [dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square [dumi-url]: https://github.com/umijs/dumi [github-issues-url]: https://new-issue.ant.design +
[![](https://user-images.githubusercontent.com/507615/209472919-6f7e8561-be8c-4b0b-9976-eb3c692aa20a.png)](https://ant.design) diff --git a/biome.json b/biome.json index ba559e8a96..3813e8237f 100644 --- a/biome.json +++ b/biome.json @@ -1,8 +1,19 @@ { - "$schema": "https://biomejs.dev/schemas/1.0.0/schema.json", + "files": { + "ignore": [ + ".dumi/tmp*", + ".dumi/scripts/clarity.js", + "dist/*", + "es/**/*", + "lib/**/*", + "_site/**/*", + "node_modules", + "server", + "scripts/previewEditor/**/*" + ] + }, "formatter": { "enabled": true, - "ignore": ["./dist/*", "./es/**/*", "./lib/**/*", "_site/**/*"], "indentStyle": "space", "lineWidth": 100, "indentWidth": 2 @@ -11,5 +22,80 @@ "formatter": { "quoteStyle": "single" } - } + }, + "organizeImports": { + "enabled": false + }, + "linter": { + "rules": { + "style": { + "useImportType": "off", + "useNumberNamespace": "off", + "useNodejsImportProtocol": "off", + "noNonNullAssertion": "off", + "noUnusedTemplateLiteral": "off" + }, + "complexity": { + "noUselessTypeConstraint": "off", + "noForEach": "off" + }, + "correctness": { + "useExhaustiveDependencies": "off" + }, + "suspicious": { + "noGlobalIsNan": "off", + "noGlobalIsFinite": "off", + "noExplicitAny": "off", + "noArrayIndexKey": "off", + "noConfusingVoidType": "off", + "noThenProperty": "off" + }, + "performance": { + "noDelete": "off", + "noAccumulatingSpread": "off" + }, + "a11y": { + "useKeyWithClickEvents": "off" + } + } + }, + "overrides": [ + { + "include": ["**/*.test.ts", "**/*.test.tsx", "tests/**/*", "scripts/**/*", ".dumi/**/*"], + "linter": { + "rules": { + "style": { + "noParameterAssign": "off" + }, + "suspicious": { + "noThenProperty": "off", + "noImplicitAnyLet": "off" + }, + "complexity": { + "noUselessFragments": "off" + }, + "a11y": { + "useValidAnchor": "off", + "useAnchorContent": "off", + "useKeyWithClickEvents": "off" + } + } + } + }, + { + "include": ["components/*/demo/*"], + "linter": { + "rules": { + "correctness": { + "noVoidTypeReturn": "off" + }, + "a11y": { + "useValidAnchor": "off", + "useAnchorContent": "off", + "useKeyWithClickEvents": "off" + } + } + } + } + ] } diff --git a/components/_util/ActionButton.tsx b/components/_util/ActionButton.tsx index db0ba99774..3e6de6e62c 100644 --- a/components/_util/ActionButton.tsx +++ b/components/_util/ActionButton.tsx @@ -8,7 +8,7 @@ import { convertLegacyProps } from '../button/buttonHelpers'; export interface ActionButtonProps { type?: LegacyButtonType; actionFn?: (...args: any[]) => any | PromiseLike; - close?: Function; + close?: (...args: any[]) => void; autoFocus?: boolean; prefixCls: string; buttonProps?: ButtonProps; @@ -22,8 +22,8 @@ export interface ActionButtonProps { isSilent?: () => boolean; } -function isThenable(thing?: PromiseLike): boolean { - return !!(thing && thing.then); +function isThenable(thing?: PromiseLike): boolean { + return !!thing?.then; } const ActionButton: React.FC = (props) => { diff --git a/components/_util/ContextIsolator.tsx b/components/_util/ContextIsolator.tsx index 502adcbc4f..88ed52a8e5 100644 --- a/components/_util/ContextIsolator.tsx +++ b/components/_util/ContextIsolator.tsx @@ -4,23 +4,21 @@ import { NoFormStyle } from '../form/context'; import { NoCompactStyle } from '../space/Compact'; const ContextIsolator: React.FC< - Readonly< - React.PropsWithChildren>> - > + Readonly>>> > = (props) => { - const { isolateSpaceContext, isolateFormContext, children } = props; + const { space, form, children } = props; if (children === undefined || children === null) { return null; } let result: React.ReactNode = children; - if (isolateFormContext) { + if (form) { result = ( {result} ); } - if (isolateSpaceContext) { + if (space) { result = {result}; } return result; diff --git a/components/_util/easings.ts b/components/_util/easings.ts index 594758ac8a..946109c1c8 100644 --- a/components/_util/easings.ts +++ b/components/_util/easings.ts @@ -1,10 +1,11 @@ -// eslint-disable-next-line import/prefer-default-export +/* eslint-disable */ export function easeInOutCubic(t: number, b: number, c: number, d: number) { const cc = c - b; + // biome-ignore lint: it is a common easing function t /= d / 2; if (t < 1) { return (cc / 2) * t * t * t + b; } - // eslint-disable-next-line no-return-assign + // biome-ignore lint: it is a common easing function return (cc / 2) * ((t -= 2) * t * t + 2) + b; } diff --git a/components/_util/getScroll.ts b/components/_util/getScroll.ts index e520d1677c..0252ebd955 100644 --- a/components/_util/getScroll.ts +++ b/components/_util/getScroll.ts @@ -19,7 +19,7 @@ const getScroll = (target: HTMLElement | Window | Document | null): number => { // `{ documentElement: { scrollLeft: 200, scrollTop: 400 } }`, // the program may falls into this branch. // Check the corresponding tests for details. Don't sure what is the real scenario this happens. - // eslint-disable-next-line dot-notation + /* biome-ignore lint/complexity/useLiteralKeys: target is a never type */ /* eslint-disable-next-line dot-notation */ result = target['scrollTop']; } diff --git a/components/_util/hooks/usePatchElement.ts b/components/_util/hooks/usePatchElement.ts index d2e9f92a89..8a946e8582 100644 --- a/components/_util/hooks/usePatchElement.ts +++ b/components/_util/hooks/usePatchElement.ts @@ -2,7 +2,7 @@ import * as React from 'react'; export default function usePatchElement(): [ React.ReactElement[], - (element: React.ReactElement) => Function, + (element: React.ReactElement) => () => void, ] { const [elements, setElements] = React.useState([]); diff --git a/components/_util/motion.ts b/components/_util/motion.ts index 474ccc8e65..fea662f269 100644 --- a/components/_util/motion.ts +++ b/components/_util/motion.ts @@ -11,7 +11,7 @@ const getCurrentHeight: MotionEventHandler = (node) => ({ height: node ? node.of const skipOpacityTransition: MotionEndEventHandler = (_, event: MotionEvent) => event?.deadline === true || (event as TransitionEvent).propertyName === 'height'; -const initCollapseMotion = (rootCls: string = 'ant'): CSSMotionProps => ({ +const initCollapseMotion = (rootCls = 'ant'): CSSMotionProps => ({ motionName: `${rootCls}-motion-collapse`, onAppearStart: getCollapsedHeight, onEnterStart: getCollapsedHeight, diff --git a/components/_util/reactNode.ts b/components/_util/reactNode.ts index aafedf5011..1d370a52d3 100644 --- a/components/_util/reactNode.ts +++ b/components/_util/reactNode.ts @@ -6,7 +6,7 @@ export function isFragment(child: any): boolean { return child && React.isValidElement(child) && child.type === React.Fragment; } -type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | void); +type RenderProps = AnyObject | ((originProps: AnyObject) => AnyObject | undefined); export const replaceElement =

( element: React.ReactNode, diff --git a/components/_util/responsiveObserver.ts b/components/_util/responsiveObserver.ts index 26a487f485..578cfac170 100644 --- a/components/_util/responsiveObserver.ts +++ b/components/_util/responsiveObserver.ts @@ -67,7 +67,7 @@ export default function useResponsiveObserver() { // To avoid repeat create instance, we add `useMemo` here. return React.useMemo(() => { - const subscribers = new Map(); + const subscribers = new Map(); let subUid = -1; let screens = {}; diff --git a/components/_util/wave/style.ts b/components/_util/wave/style.ts index 6bc8ce9e21..b5b757535f 100644 --- a/components/_util/wave/style.ts +++ b/components/_util/wave/style.ts @@ -1,6 +1,7 @@ import { genComponentStyleHook } from '../../theme/internal'; import type { FullToken, GenerateStyle } from '../../theme/internal'; +// biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default export interface ComponentToken {} export interface WaveToken extends FullToken<'Wave'> {} diff --git a/components/_util/wave/util.ts b/components/_util/wave/util.ts index cd5bf63770..7d3534b485 100644 --- a/components/_util/wave/util.ts +++ b/components/_util/wave/util.ts @@ -1,6 +1,7 @@ export function isNotGrey(color: string) { // eslint-disable-next-line no-useless-escape const match = (color || '').match(/rgba?\((\d*), (\d*), (\d*)(, [\d.]*)?\)/); + // biome-ignore lint/complexity/useOptionalChain: this is way is more simple if (match && match[1] && match[2] && match[3]) { return !(match[1] === match[2] && match[2] === match[3]); } diff --git a/components/alert/Alert.tsx b/components/alert/Alert.tsx index a529226c0b..3f64697636 100644 --- a/components/alert/Alert.tsx +++ b/components/alert/Alert.tsx @@ -7,8 +7,8 @@ import ExclamationCircleFilled from '@ant-design/icons/ExclamationCircleFilled'; import InfoCircleFilled from '@ant-design/icons/InfoCircleFilled'; import classNames from 'classnames'; import CSSMotion from 'rc-motion'; -import { composeRef } from 'rc-util/lib/ref'; import pickAttrs from 'rc-util/lib/pickAttrs'; +import { composeRef } from 'rc-util/lib/ref'; import type { ClosableType } from '../_util/hooks/useClosable'; import { replaceElement } from '../_util/reactNode'; diff --git a/components/alert/ErrorBoundary.tsx b/components/alert/ErrorBoundary.tsx index c12595e11e..995f7de8eb 100644 --- a/components/alert/ErrorBoundary.tsx +++ b/components/alert/ErrorBoundary.tsx @@ -31,7 +31,7 @@ class ErrorBoundary extends React.Component = (token: AlertToken): CSSO lineHeight: 0, }, - [`&-description`]: { + '&-description': { display: 'none', fontSize, lineHeight, @@ -204,7 +204,7 @@ export const genActionStyle: GenerateStyle = (token: AlertToken): CS return { [componentCls]: { - [`&-action`]: { + '&-action': { marginInlineStart: marginXS, }, diff --git a/components/anchor/Anchor.tsx b/components/anchor/Anchor.tsx index e522b15dc9..53234a34a7 100644 --- a/components/anchor/Anchor.tsx +++ b/components/anchor/Anchor.tsx @@ -35,8 +35,7 @@ function getOffsetTop(element: HTMLElement, container: AnchorContainer): number if (rect.width || rect.height) { if (container === window) { - container = element.ownerDocument!.documentElement!; - return rect.top - container.clientTop; + return rect.top - element.ownerDocument!.documentElement!.clientTop; } return rect.top - (container as HTMLElement).getBoundingClientRect().top; } diff --git a/components/app/__tests__/index.test.tsx b/components/app/__tests__/index.test.tsx index 6c101841b3..6000db19a2 100644 --- a/components/app/__tests__/index.test.tsx +++ b/components/app/__tests__/index.test.tsx @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import { SmileOutlined } from '@ant-design/icons'; -import type { NotificationConfig } from 'antd/es/notification/interface'; import ConfigProvider from 'antd/es/config-provider'; +import type { NotificationConfig } from 'antd/es/notification/interface'; import App from '..'; import mountTest from '../../../tests/shared/mountTest'; diff --git a/components/app/style/index.ts b/components/app/style/index.ts index bd56801eca..a2580d54df 100644 --- a/components/app/style/index.ts +++ b/components/app/style/index.ts @@ -1,7 +1,8 @@ import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal'; import { genStyleHooks } from '../../theme/internal'; -export type ComponentToken = {}; +// biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default +export interface ComponentToken {} interface AppToken extends FullToken<'App'> {} diff --git a/components/auto-complete/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/auto-complete/__tests__/__snapshots__/demo-extend.test.ts.snap index 1491ae112b..8c754cb013 100644 --- a/components/auto-complete/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/auto-complete/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -757,6 +757,9 @@ exports[`renders components/auto-complete/demo/form-debug.tsx extend context cor width="64" xmlns="http://www.w3.org/2000/svg" > + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + = ( diff --git a/components/avatar/style/index.ts b/components/avatar/style/index.ts index 97be5147f5..6d0e3f8515 100644 --- a/components/avatar/style/index.ts +++ b/components/avatar/style/index.ts @@ -112,7 +112,7 @@ const genBaseStyle: GenerateStyle = (token) => { background: avatarBg, border: `${unit(lineWidth)} ${lineType} transparent`, - [`&-image`]: { + '&-image': { background: 'transparent', }, @@ -122,11 +122,11 @@ const genBaseStyle: GenerateStyle = (token) => { ...avatarSizeStyle(containerSize, textFontSize, borderRadius), - [`&-lg`]: { + '&-lg': { ...avatarSizeStyle(containerSizeLG, textFontSizeLG, borderRadiusLG), }, - [`&-sm`]: { + '&-sm': { ...avatarSizeStyle(containerSizeSM, textFontSizeSM, borderRadiusSM), }, @@ -151,7 +151,7 @@ const genGroupStyle: GenerateStyle = (token) => { borderColor: groupBorderColor, }, - [`> *:not(:first-child)`]: { + '> *:not(:first-child)': { marginInlineStart: groupOverlapping, }, }, diff --git a/components/back-top/index.tsx b/components/back-top/index.tsx index 4ede550584..8961b54959 100644 --- a/components/back-top/index.tsx +++ b/components/back-top/index.tsx @@ -40,7 +40,7 @@ const BackTop: React.FC = (props) => { const ref = React.useRef(null); const getDefaultTarget = (): HTMLElement | Document | Window => - ref.current && ref.current.ownerDocument ? ref.current.ownerDocument : window; + ref.current?.ownerDocument || window; const handleScroll = throttleByAnimationFrame( (e: React.UIEvent | { target: any }) => { diff --git a/components/badge/ScrollNumber.tsx b/components/badge/ScrollNumber.tsx index 1fcf8a82fb..4324f7f575 100644 --- a/components/badge/ScrollNumber.tsx +++ b/components/badge/ScrollNumber.tsx @@ -70,7 +70,7 @@ const ScrollNumber = React.forwardRef((props, re // allow specify the border // mock border-color by box-shadow for compatible with old usage: // - if (style && style.borderColor) { + if (style?.borderColor) { newProps.style = { ...style, boxShadow: `0 0 0 1px ${style.borderColor} inset`, diff --git a/components/breadcrumb/style/index.ts b/components/breadcrumb/style/index.ts index 2a229ed787..80707c0ac0 100644 --- a/components/breadcrumb/style/index.ts +++ b/components/breadcrumb/style/index.ts @@ -83,7 +83,7 @@ const genBreadcrumbStyle: GenerateStyle = (token) => ...genFocusStyle(token), }, - [`li:last-child`]: { + 'li:last-child': { color: token.lastItemColor, }, diff --git a/components/button/__tests__/index.test.tsx b/components/button/__tests__/index.test.tsx index 892bd355fc..e9ce715193 100644 --- a/components/button/__tests__/index.test.tsx +++ b/components/button/__tests__/index.test.tsx @@ -401,9 +401,11 @@ describe('Button', () => { promiseCache.resolve = resolve; }); throw promiseCache.promise; - } else if (freeze) { + } + if (freeze) { throw promiseCache.promise; - } else if (promiseCache.promise) { + } + if (promiseCache.promise) { promiseCache.resolve?.(); promiseCache.promise = undefined; } diff --git a/components/button/button-group.tsx b/components/button/button-group.tsx index 5b10440e20..056b7eca2e 100644 --- a/components/button/button-group.tsx +++ b/components/button/button-group.tsx @@ -33,7 +33,6 @@ const ButtonGroup: React.FC = (props) => { case 'small': sizeCls = 'sm'; break; - case 'middle': default: // Do nothing } diff --git a/components/button/buttonHelpers.tsx b/components/button/buttonHelpers.tsx index 3c40eb5084..40345b2db0 100644 --- a/components/button/buttonHelpers.tsx +++ b/components/button/buttonHelpers.tsx @@ -53,7 +53,7 @@ function splitCNCharsBySpace(child: React.ReactElement | string | number, needIn } export function spaceChildren(children: React.ReactNode, needInserted: boolean) { - let isPrevChildPure: boolean = false; + let isPrevChildPure = false; const childList: React.ReactNode[] = []; React.Children.forEach(children, (child) => { diff --git a/components/button/style/group.ts b/components/button/style/group.ts index 75de12cc5a..2f7a574133 100644 --- a/components/button/style/group.ts +++ b/components/button/style/group.ts @@ -54,9 +54,7 @@ const genGroupStyle: GenerateStyle = (token) => { position: 'relative', zIndex: 1, - [`&:hover, - &:focus, - &:active`]: { + '&:hover, &:focus, &:active': { zIndex: 2, }, diff --git a/components/button/style/index.ts b/components/button/style/index.ts index 0565b57853..0c0a619caa 100644 --- a/components/button/style/index.ts +++ b/components/button/style/index.ts @@ -386,7 +386,7 @@ const genTypeButtonStyle: GenerateStyle = (token) => { }; // =============================== Size =============================== -const genButtonStyle = (token: ButtonToken, prefixCls: string = ''): CSSInterpolation => { +const genButtonStyle = (token: ButtonToken, prefixCls = ''): CSSInterpolation => { const { componentCls, controlHeight, diff --git a/components/calendar/demo/lunar.tsx b/components/calendar/demo/lunar.tsx index 145580a345..2d76012978 100644 --- a/components/calendar/demo/lunar.tsx +++ b/components/calendar/demo/lunar.tsx @@ -85,7 +85,7 @@ const useStyle = createStyles(({ token, css, cx }) => { weekend: css` color: ${token.colorError}; &.gray { - opacity: .4 + opacity: 0.4; } `, }; diff --git a/components/calendar/demo/notice-calendar.tsx b/components/calendar/demo/notice-calendar.tsx index 8243a390df..d661a126bf 100644 --- a/components/calendar/demo/notice-calendar.tsx +++ b/components/calendar/demo/notice-calendar.tsx @@ -4,7 +4,7 @@ import { Badge, Calendar } from 'antd'; import type { Dayjs } from 'dayjs'; const getListData = (value: Dayjs) => { - let listData; + let listData: { type: string; content: string }[] = []; // Specify the type of listData switch (value.date()) { case 8: listData = [ diff --git a/components/calendar/generateCalendar.tsx b/components/calendar/generateCalendar.tsx index 4bf3304602..9590edb14e 100644 --- a/components/calendar/generateCalendar.tsx +++ b/components/calendar/generateCalendar.tsx @@ -182,7 +182,7 @@ function generateCalendar(generateConfig: GenerateCo }; result.lang = { ...result.lang, - ...(locale || {}).lang, + ...locale?.lang, }; return result; }; @@ -207,7 +207,7 @@ function generateCalendar(generateConfig: GenerateCo {String(generateConfig.getDate(date)).padStart(2, '0')}

- {cellRender ? cellRender(date, info) : dateCellRender && dateCellRender(date)} + {cellRender ? cellRender(date, info) : dateCellRender?.(date)}
); @@ -237,7 +237,7 @@ function generateCalendar(generateConfig: GenerateCo {months[generateConfig.getMonth(date)]}
- {cellRender ? cellRender(date, info) : monthCellRender && monthCellRender(date)} + {cellRender ? cellRender(date, info) : monthCellRender?.(date)}
); diff --git a/components/card/Card.tsx b/components/card/Card.tsx index 658e666d9d..73a1f27ff4 100644 --- a/components/card/Card.tsx +++ b/components/card/Card.tsx @@ -148,7 +148,7 @@ const Card = React.forwardRef((props, ref) => { const isContainGrid = React.useMemo(() => { let containGrid = false; React.Children.forEach(children as React.ReactElement, (element: JSX.Element) => { - if (element && element.type && element.type === Grid) { + if (element?.type === Grid) { containGrid = true; } }); @@ -229,14 +229,13 @@ const Card = React.forwardRef((props, ref) => { ); const actionClasses = classNames(`${prefixCls}-actions`, moduleClass('actions')); - const actionDom = - actions && actions.length ? ( - - ) : null; + const actionDom = actions?.length ? ( + + ) : null; const divProps = omit(others, ['onTabChange']); @@ -248,7 +247,7 @@ const Card = React.forwardRef((props, ref) => { [`${prefixCls}-bordered`]: bordered, [`${prefixCls}-hoverable`]: hoverable, [`${prefixCls}-contain-grid`]: isContainGrid, - [`${prefixCls}-contain-tabs`]: tabList && tabList.length, + [`${prefixCls}-contain-tabs`]: tabList?.length, [`${prefixCls}-${mergedSize}`]: mergedSize, [`${prefixCls}-type-${type}`]: !!type, [`${prefixCls}-rtl`]: direction === 'rtl', diff --git a/components/carousel/style/index.ts b/components/carousel/style/index.ts index 87660d6cf6..247481c00e 100644 --- a/components/carousel/style/index.ts +++ b/components/carousel/style/index.ts @@ -152,7 +152,7 @@ const genCarouselStyle: GenerateStyle = (token) => { const genArrowsStyle: GenerateStyle = (token) => { const { componentCls, motionDurationSlow, arrowSize, arrowOffset } = token; - const arrowLength = token.calc(arrowSize).div(1.414).equal(); + const arrowLength = token.calc(arrowSize).div(Math.SQRT2).equal(); return [ { diff --git a/components/cascader/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/cascader/__tests__/__snapshots__/demo-extend.test.ts.snap index 73889f9b43..e687cd198f 100644 --- a/components/cascader/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/cascader/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -1922,6 +1922,9 @@ exports[`renders components/cascader/demo/panel.tsx extend context correctly 1`] width="64" xmlns="http://www.w3.org/2000/svg" > + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + = (token: CascaderToken): CS }, [`&-active:not(${cascaderMenuItemCls}-disabled)`]: { - [`&, &:hover`]: { + '&, &:hover': { fontWeight: token.optionSelectedFontWeight, backgroundColor: token.optionSelectedBg, }, diff --git a/components/checkbox/style/index.ts b/components/checkbox/style/index.ts index ae4a2dfc7c..f7171f87ff 100644 --- a/components/checkbox/style/index.ts +++ b/components/checkbox/style/index.ts @@ -4,6 +4,7 @@ import { genFocusOutline, resetComponent } from '../../style'; import type { FullToken, GenerateStyle } from '../../theme/internal'; import { genStyleHooks, mergeToken } from '../../theme/internal'; +// biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default export interface ComponentToken {} interface CheckboxToken extends FullToken<'Checkbox'> { diff --git a/components/collapse/style/index.ts b/components/collapse/style/index.ts index 1113da38b5..dfc96939ba 100644 --- a/components/collapse/style/index.ts +++ b/components/collapse/style/index.ts @@ -77,13 +77,13 @@ export const genBaseStyle: GenerateStyle = (token) => { border: borderBase, borderRadius: collapsePanelBorderRadius, - [`&-rtl`]: { + '&-rtl': { direction: 'rtl', }, [`& > ${componentCls}-item`]: { borderBottom: borderBase, - [`&:last-child`]: { + '&:last-child': { [` &, & > ${componentCls}-header`]: { @@ -155,12 +155,12 @@ export const genBaseStyle: GenerateStyle = (token) => { padding: contentPadding, }, - [`&-hidden`]: { + '&-hidden': { display: 'none', }, }, - [`&-small`]: { + '&-small': { [`> ${componentCls}-item`]: { [`> ${componentCls}-header`]: { padding: collapseHeaderPaddingSM, @@ -177,7 +177,7 @@ export const genBaseStyle: GenerateStyle = (token) => { }, }, - [`&-large`]: { + '&-large': { [`> ${componentCls}-item`]: { fontSize: fontSizeLG, lineHeight: lineHeightLG, diff --git a/components/color-picker/ColorPicker.tsx b/components/color-picker/ColorPicker.tsx index e4f3b2b49d..4a1d7ba73c 100644 --- a/components/color-picker/ColorPicker.tsx +++ b/components/color-picker/ColorPicker.tsx @@ -199,7 +199,7 @@ const ColorPicker: CompoundedComponent = (props) => { } }} content={ - + ) { this.metaColor = new RcColor(color as ColorGenInput); diff --git a/components/color-picker/components/ColorInput.tsx b/components/color-picker/components/ColorInput.tsx index 79b79a0aa2..b3b54b7ecc 100644 --- a/components/color-picker/components/ColorInput.tsx +++ b/components/color-picker/components/ColorInput.tsx @@ -42,7 +42,7 @@ const ColorInput: FC = (props) => { return ; case ColorFormat.rgb: return ; - case ColorFormat.hex: + // case ColorFormat.hex: default: return ; } diff --git a/components/color-picker/components/ColorTrigger.tsx b/components/color-picker/components/ColorTrigger.tsx index f11da241d2..de7618f84f 100644 --- a/components/color-picker/components/ColorTrigger.tsx +++ b/components/color-picker/components/ColorTrigger.tsx @@ -41,7 +41,7 @@ const ColorTrigger = forwardRef((props, ref) return color.toRgbString(); case 'hsb': return color.toHsbString(); - case 'hex': + // case 'hex': default: return alpha < 100 ? `${hexString.slice(0, 7)},${alpha}%` : hexString; } diff --git a/components/color-picker/style/index.ts b/components/color-picker/style/index.ts index 8196c71ae5..f32cd7fe01 100644 --- a/components/color-picker/style/index.ts +++ b/components/color-picker/style/index.ts @@ -8,6 +8,7 @@ import genInputStyle from './input'; import genPickerStyle from './picker'; import genPresetsStyle from './presets'; +// biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default export interface ComponentToken {} export interface ColorPickerToken extends FullToken<'ColorPicker'> { diff --git a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap index 64ab9f54e8..9782a59615 100644 --- a/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap +++ b/components/config-provider/__tests__/__snapshots__/components.test.tsx.snap @@ -14999,6 +14999,9 @@ exports[`ConfigProvider components Empty configProvider 1`] = ` width="184" xmlns="http://www.w3.org/2000/svg" > + + empty image + + + empty image + + + empty image + + + empty image + + + empty image + + + empty image + + + empty image + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + + + Simple Empty + () => mockCanUseDom); diff --git a/components/config-provider/demo/wave.tsx b/components/config-provider/demo/wave.tsx index a75ae94369..c31a20a8f6 100644 --- a/components/config-provider/demo/wave.tsx +++ b/components/config-provider/demo/wave.tsx @@ -23,13 +23,7 @@ const createHolder = (node: HTMLElement) => { return div; }; -const createDot = ( - holder: HTMLElement, - color: string, - left: number, - top: number, - size: number = 0, -) => { +const createDot = (holder: HTMLElement, color: string, left: number, top: number, size = 0) => { const dot = document.createElement('div'); dot.style.position = 'absolute'; dot.style.left = `${left}px`; diff --git a/components/date-picker/generatePicker/generateRangePicker.tsx b/components/date-picker/generatePicker/generateRangePicker.tsx index 538913d296..bec61cc77a 100644 --- a/components/date-picker/generatePicker/generateRangePicker.tsx +++ b/components/date-picker/generatePicker/generateRangePicker.tsx @@ -107,7 +107,7 @@ export default function generateRangePicker( const [zIndex] = useZIndex('DatePicker', props.popupStyle?.zIndex as number); return wrapCSSVar( - + separator={ diff --git a/components/date-picker/generatePicker/generateSinglePicker.tsx b/components/date-picker/generatePicker/generateSinglePicker.tsx index 08d30cc5e5..44018eb0b3 100644 --- a/components/date-picker/generatePicker/generateSinglePicker.tsx +++ b/components/date-picker/generatePicker/generateSinglePicker.tsx @@ -146,7 +146,7 @@ export default function generatePicker( const [zIndex] = useZIndex('DatePicker', props.popupStyle?.zIndex as number); return wrapCSSVar( - + ref={innerRef} placeholder={getPlaceholder(locale, mergedPicker, placeholder)} diff --git a/components/date-picker/style/panel.ts b/components/date-picker/style/panel.ts index 858e840a54..074028626c 100644 --- a/components/date-picker/style/panel.ts +++ b/components/date-picker/style/panel.ts @@ -330,13 +330,11 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => { }, }, - [`&-prev-icon, - &-super-prev-icon`]: { + '&-prev-icon, &-super-prev-icon': { transform: 'rotate(-45deg)', }, - [`&-next-icon, - &-super-next-icon`]: { + '&-next-icon, &-super-next-icon': { transform: 'rotate(135deg)', }, @@ -459,16 +457,13 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => { }, }, - [`&:hover td`]: { + '&:hover td': { '&:before': { background: cellHoverBg, }, }, - [`&-range-start td, - &-range-end td, - &-selected td, - &-hover td`]: { + '&-range-start td, &-range-end td, &-selected td, &-hover td': { // Rise priority to override hover style [`&${pickerCellCls}`]: { '&:before': { @@ -485,14 +480,14 @@ export const genPanelStyle = (token: SharedPickerToken): CSSObject => { }, }, - [`&-range-hover td:before`]: { + '&-range-hover td:before': { background: controlItemBgActive, }, }, }, // >>> ShowWeek - [`&-week-panel, &-date-panel-show-week`]: { + '&-week-panel, &-date-panel-show-week': { [`${componentCls}-body`]: { padding: `${unit(paddingXS)} ${unit(paddingSM)}`, }, diff --git a/components/descriptions/style/index.ts b/components/descriptions/style/index.ts index c37f44b3da..7d97ff1169 100644 --- a/components/descriptions/style/index.ts +++ b/components/descriptions/style/index.ts @@ -113,7 +113,7 @@ const genDescriptionStyles: GenerateStyle = (token) => { [componentCls]: { ...resetComponent(token), ...genBorderedStyle(token), - [`&-rtl`]: { + '&-rtl': { direction: 'rtl', }, [`${componentCls}-header`]: { diff --git a/components/divider/index.tsx b/components/divider/index.tsx index 2a4e96beae..954d8f8e05 100644 --- a/components/divider/index.tsx +++ b/components/divider/index.tsx @@ -91,6 +91,7 @@ const Divider: React.FC = (props) => { className={classString} style={{ ...divider?.style, ...style }} {...restProps} + // biome-ignore lint/a11y/useAriaPropsForRole: divider do not need aria-value role="separator" > {children && type !== 'vertical' && ( diff --git a/components/drawer/index.tsx b/components/drawer/index.tsx index e2374047be..be9a8b020d 100644 --- a/components/drawer/index.tsx +++ b/components/drawer/index.tsx @@ -160,7 +160,7 @@ const Drawer: React.FC & { const { classNames: contextClassNames = {}, styles: contextStyles = {} } = drawer || {}; return wrapCSSVar( - + { }); const triggerActions = disabled ? [] : trigger; - let alignPoint: boolean; - if (triggerActions && triggerActions.includes('contextMenu')) { - alignPoint = true; - } + const alignPoint = !!triggerActions?.includes('contextMenu'); // =========================== Open ============================ const [mergedOpen, setOpen] = useMergedState(false, { @@ -283,7 +280,7 @@ const Dropdown: CompoundedComponent = (props) => { // ============================ Render ============================ let renderNode = ( = (token) => { transition: `all ${motionDurationMid}`, borderRadius: token.borderRadiusSM, - [`&:hover, &-active`]: { + '&:hover, &-active': { backgroundColor: token.controlItemBgHover, }, diff --git a/components/empty/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/empty/__tests__/__snapshots__/demo-extend.test.ts.snap index 7a59342d9d..e05091de35 100644 --- a/components/empty/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/empty/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -13,6 +13,9 @@ exports[`renders components/empty/demo/basic.tsx extend context correctly 1`] = width="184" xmlns="http://www.w3.org/2000/svg" > + + empty image + + + empty image + + + Simple Empty + + + empty image + + + empty image + + + Simple Empty + + + empty image + + + empty image + { viewBox="0 0 184 152" xmlns="http://www.w3.org/2000/svg" > + empty image { return ( + Simple Empty diff --git a/components/empty/style/index.ts b/components/empty/style/index.ts index 4d5c018f7e..407efb8b33 100644 --- a/components/empty/style/index.ts +++ b/components/empty/style/index.ts @@ -4,6 +4,7 @@ import type { FullToken, GenerateStyle } from '../../theme/internal'; import { genStyleHooks, mergeToken } from '../../theme/internal'; /** Component only token. Which will handle additional calculation of alias token */ +// biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default export interface ComponentToken {} interface EmptyToken extends FullToken<'Empty'> { diff --git a/components/flex/style/index.ts b/components/flex/style/index.ts index 9fd7763515..0c677ddd83 100644 --- a/components/flex/style/index.ts +++ b/components/flex/style/index.ts @@ -5,9 +5,8 @@ import { genStyleHooks, mergeToken } from '../../theme/internal'; import { alignItemsValues, flexWrapValues, justifyContentValues } from '../utils'; /** Component only token. Which will handle additional calculation of alias token */ -export interface ComponentToken { - // Component token here -} +// biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default +export interface ComponentToken {} export interface FlexToken extends FullToken<'Flex'> { /** diff --git a/components/float-button/BackTop.tsx b/components/float-button/BackTop.tsx index 0fce5d43cf..b30f8935d6 100644 --- a/components/float-button/BackTop.tsx +++ b/components/float-button/BackTop.tsx @@ -42,9 +42,7 @@ const BackTop = React.forwardRef((props, ref) => { })); const getDefaultTarget = (): HTMLElement | Document | Window => - internalRef.current && internalRef.current.ownerDocument - ? internalRef.current.ownerDocument - : window; + internalRef.current?.ownerDocument || window; const handleScroll = throttleByAnimationFrame( (e: React.UIEvent | { target: any }) => { diff --git a/components/float-button/interface.ts b/components/float-button/interface.ts index 72f0fbad97..d7e339cc84 100644 --- a/components/float-button/interface.ts +++ b/components/float-button/interface.ts @@ -30,7 +30,7 @@ export interface FloatButtonProps extends React.DOMAttributes['aria-label']; + 'aria-label'?: React.HtmlHTMLAttributes['aria-label']; } export interface FloatButtonContentProps extends React.DOMAttributes { diff --git a/components/form/ErrorList.tsx b/components/form/ErrorList.tsx index 9723099f5c..c9197d7209 100644 --- a/components/form/ErrorList.tsx +++ b/components/form/ErrorList.tsx @@ -23,7 +23,7 @@ function toErrorEntity( error: React.ReactNode, prefix: string, errorStatus?: ValidateStatus, - index: number = 0, + index = 0, ): ErrorEntity { return { key: typeof error === 'string' ? error : `${prefix}-${index}`, diff --git a/components/form/FormItem/index.tsx b/components/form/FormItem/index.tsx index aa1ccbac45..75104acd21 100644 --- a/components/form/FormItem/index.tsx +++ b/components/form/FormItem/index.tsx @@ -312,19 +312,16 @@ function InternalFormItem(props: FormItemProps): React.Rea const isRequired = required !== undefined ? required - : !!( - rules && - rules.some((rule) => { - if (rule && typeof rule === 'object' && rule.required && !rule.warningOnly) { - return true; - } - if (typeof rule === 'function') { - const ruleEntity = rule(context); - return ruleEntity && ruleEntity.required && !ruleEntity.warningOnly; - } - return false; - }) - ); + : !!rules?.some((rule) => { + if (rule && typeof rule === 'object' && rule.required && !rule.warningOnly) { + return true; + } + if (typeof rule === 'function') { + const ruleEntity = rule(context); + return ruleEntity?.required && !ruleEntity?.warningOnly; + } + return false; + }); // ======================= Children ======================= const mergedControl: typeof control = { diff --git a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap index 7aaca99d43..c52bf6baec 100644 --- a/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/form/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -30605,6 +30605,9 @@ exports[`renders components/form/demo/variant.tsx extend context correctly 1`] = width="64" xmlns="http://www.w3.org/2000/svg" > + + Simple Empty + + + Simple Empty + + + Simple Empty + { }); it('useFormInstance', () => { - let formInstance; - let subFormInstance; + let formInstance: any; + let subFormInstance: any; const Sub = () => { const formSub = Form.useFormInstance(); diff --git a/components/form/__tests__/list.test.tsx b/components/form/__tests__/list.test.tsx index dffd7ab997..c0109cff1c 100644 --- a/components/form/__tests__/list.test.tsx +++ b/components/form/__tests__/list.test.tsx @@ -137,8 +137,7 @@ describe('Form.List', () => { {(fields, { add, remove }) => ( <> {fields.map((field) => ( - // key is in a field - // eslint-disable-next-line react/jsx-key + /* biome-ignore lint/correctness/useJsxKeyInIterable: key is in a field */ /* eslint-disable-next-line react/jsx-key */ @@ -313,7 +312,7 @@ describe('Form.List', () => { render(
- + {(fields) => fields.map((field) => ( diff --git a/components/form/hooks/useForm.ts b/components/form/hooks/useForm.ts index b5601b1502..25b566ae86 100644 --- a/components/form/hooks/useForm.ts +++ b/components/form/hooks/useForm.ts @@ -1,8 +1,8 @@ import * as React from 'react'; import type { FormInstance as RcFormInstance } from 'rc-field-form'; import { useForm as useRcForm } from 'rc-field-form'; -import scrollIntoView from 'scroll-into-view-if-needed'; import { getDOM } from 'rc-util/lib/Dom/findDOMNode'; +import scrollIntoView from 'scroll-into-view-if-needed'; import type { InternalNamePath, NamePath, ScrollOptions } from '../interface'; import { getFieldId, toArray } from '../util'; diff --git a/components/form/style/explain.ts b/components/form/style/explain.ts index eba79c81a2..5ecff1d489 100644 --- a/components/form/style/explain.ts +++ b/components/form/style/explain.ts @@ -39,7 +39,7 @@ const genFormValidateMotionStyle: GenerateStyle = (token) => { transform: `translateY(-5px)`, opacity: 0, - [`&-active`]: { + '&-active': { transform: 'translateY(0)', opacity: 1, }, diff --git a/components/grid/__tests__/index.test.tsx b/components/grid/__tests__/index.test.tsx index 8faf4312a2..b903bd04f2 100644 --- a/components/grid/__tests__/index.test.tsx +++ b/components/grid/__tests__/index.test.tsx @@ -153,7 +153,7 @@ describe('Grid', () => { }) as any, ); - let screensVar; + let screensVar: any = null; function Demo() { const screens = useBreakpoint(); screensVar = screens; diff --git a/components/grid/hooks/useBreakpoint.tsx b/components/grid/hooks/useBreakpoint.tsx index 5b08dfb437..71f13ced39 100644 --- a/components/grid/hooks/useBreakpoint.tsx +++ b/components/grid/hooks/useBreakpoint.tsx @@ -5,7 +5,7 @@ import useForceUpdate from '../../_util/hooks/useForceUpdate'; import type { ScreenMap } from '../../_util/responsiveObserver'; import useResponsiveObserver from '../../_util/responsiveObserver'; -function useBreakpoint(refreshOnChange: boolean = true): ScreenMap { +function useBreakpoint(refreshOnChange = true): ScreenMap { const screensRef = useRef({}); const forceUpdate = useForceUpdate(); const responsiveObserver = useResponsiveObserver(); diff --git a/components/grid/style/index.ts b/components/grid/style/index.ts index 0076a03677..e94f17d28f 100644 --- a/components/grid/style/index.ts +++ b/components/grid/style/index.ts @@ -4,9 +4,8 @@ import type { CSSObject } from '@ant-design/cssinjs'; import type { FullToken, GenerateStyle, GetDefaultToken } from '../../theme/internal'; import { genStyleHooks, mergeToken } from '../../theme/internal'; -export interface ComponentToken { - // -} +// biome-ignore lint/suspicious/noEmptyInterface: ComponentToken need to be empty by default +export interface ComponentToken {} interface GridRowToken extends FullToken<'Grid'> { // diff --git a/components/icon/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/icon/__tests__/__snapshots__/demo-extend.test.ts.snap index 7d7731c3a5..d05d26018d 100644 --- a/components/icon/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/icon/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -166,6 +166,9 @@ exports[`renders components/icon/demo/custom.tsx extend context correctly 1`] = viewBox="0 0 1024 1024" width="1em" > + + heart icon + @@ -186,6 +189,9 @@ exports[`renders components/icon/demo/custom.tsx extend context correctly 1`] = viewBox="0 0 1024 1024" width="1em" > + + Panda icon + + + heart icon + @@ -184,6 +187,9 @@ exports[`renders components/icon/demo/custom.tsx correctly 1`] = ` viewBox="0 0 1024 1024" width="1em" > + + Panda icon + ; const HeartSvg = () => ( + heart icon ); const PandaSvg = () => ( + Panda icon { background: operationBgHover.toRgbString(), }, - [`&-disabled`]: { + '&-disabled': { '&, &:hover': { color: previewOperationColorDisabled, background: 'transparent', @@ -353,7 +353,7 @@ const genPreviewMotion: GenerateStyle = (token) => { return { [`${previewCls}-root`]: initZoomMotion(token, 'zoom'), - [`&`]: initFadeMotion(token, true), + '&': initFadeMotion(token, true), }; }; diff --git a/components/input-number/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/input-number/__tests__/__snapshots__/demo-extend.test.ts.snap index d2cac021e4..809ce648b1 100644 --- a/components/input-number/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/input-number/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -697,6 +697,9 @@ exports[`renders components/input-number/demo/addon.tsx extend context correctly width="64" xmlns="http://www.w3.org/2000/svg" > + + Simple Empty + ((props, const [variant, enableVariantCls] = useVariant(customVariant, bordered); - // eslint-disable-next-line react/jsx-no-useless-fragment + /* biome-ignore lint/complexity/noUselessFragments: avoid falsy value */ /* eslint-disable-next-line react/jsx-no-useless-fragment */ const suffixNode = hasFeedback && <>{feedbackIcon}; const inputNumberClass = classNames( @@ -139,14 +139,14 @@ const InputNumber = React.forwardRef((props, suffix={suffixNode} addonBefore={ addonBefore && ( - + {addonBefore} ) } addonAfter={ addonAfter && ( - + {addonAfter} ) diff --git a/components/input-number/style/index.ts b/components/input-number/style/index.ts index d27d0e592d..65406c3423 100644 --- a/components/input-number/style/index.ts +++ b/components/input-number/style/index.ts @@ -231,7 +231,6 @@ const genInputNumberStyles: GenerateStyle = (token: InputNumbe '&[type="number"]::-webkit-inner-spin-button, &[type="number"]::-webkit-outer-spin-button': { margin: 0, - /* stylelint-disable-next-line property-no-vendor-prefix */ webkitAppearance: 'none', appearance: 'none', }, diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 6001468f80..424c2e6aac 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -200,14 +200,14 @@ const Input = forwardRef((props, ref) => { onChange={handleChange} addonBefore={ addonBefore && ( - + {addonBefore} ) } addonAfter={ addonAfter && ( - + {addonAfter} ) diff --git a/components/input/Search.tsx b/components/input/Search.tsx index c8ad1cfea1..e11be15968 100644 --- a/components/input/Search.tsx +++ b/components/input/Search.tsx @@ -58,14 +58,12 @@ const Search = React.forwardRef((props, ref) => { const inputRef = React.useRef(null); const onChange = (e: React.ChangeEvent) => { - if (e && e.target && e.type === 'click' && customOnSearch) { + if (e?.target && e.type === 'click' && customOnSearch) { customOnSearch((e as React.ChangeEvent).target.value, e, { source: 'clear', }); } - if (customOnChange) { - customOnChange(e); - } + customOnChange?.(e); }; const onMouseDown: React.MouseEventHandler = (e) => { diff --git a/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap index 7c3188c68b..8f72627c23 100644 --- a/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/input/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -519,6 +519,9 @@ exports[`renders components/input/demo/addon.tsx extend context correctly 1`] = width="64" xmlns="http://www.w3.org/2000/svg" > + + Simple Empty + + + Simple Empty + { borderSpacing: 0, // Undo padding and float of grid classes - [`&[class*='col-']`]: { + "&[class*='col-']": { paddingInlineEnd: token.paddingXS, '&:last-child': { @@ -140,7 +140,7 @@ export const genInputGroupStyle = (token: InputToken): CSSObject => { }, [`${componentCls}-group`]: { - [`&-addon, &-wrap`]: { + '&-addon, &-wrap': { display: 'table-cell', width: 1, whiteSpace: 'nowrap', diff --git a/components/input/style/variants.ts b/components/input/style/variants.ts index bcc1de65ad..2b433d7153 100644 --- a/components/input/style/variants.ts +++ b/components/input/style/variants.ts @@ -17,7 +17,7 @@ export const genDisabledStyle = (token: InputToken): CSSObject => ({ cursor: 'not-allowed', opacity: 1, - [`input[disabled], textarea[disabled]`]: { + 'input[disabled], textarea[disabled]': { cursor: 'not-allowed', }, @@ -203,7 +203,7 @@ const genBaseFilledStyle = ( borderStyle: token.lineType, borderColor: 'transparent', - [`input&, & input, textarea&, & textarea`]: { + 'input&, & input, textarea&, & textarea': { color: options?.inputColor, }, diff --git a/components/layout/Sider.tsx b/components/layout/Sider.tsx index 2338e57f73..eb8d090b0d 100644 --- a/components/layout/Sider.tsx +++ b/components/layout/Sider.tsx @@ -52,7 +52,7 @@ export interface SiderState { const generateId = (() => { let i = 0; - return (prefix: string = '') => { + return (prefix = '') => { i += 1; return `${prefix}${i}`; }; diff --git a/components/list/Item.tsx b/components/list/Item.tsx index 9d3fe0c37e..28391e88e1 100644 --- a/components/list/Item.tsx +++ b/components/list/Item.tsx @@ -90,7 +90,7 @@ const InternalItem = React.forwardRef((props, ref }); const isItemContainsTextNodeAndNotSingular = () => { - let result; + let result = false; Children.forEach(children as ReactElement, (element) => { if (typeof element === 'string') { result = true; @@ -107,7 +107,7 @@ const InternalItem = React.forwardRef((props, ref }; const prefixCls = getPrefixCls('list', customizePrefixCls); - const actionsContent = actions && actions.length > 0 && ( + const actionsContent = actions?.length && (