chore: fix biome error (#54682)
Some checks failed
✅ test / test-react-legacy (push) Failing after 53s
✅ test / test-node (push) Failing after 55s
✅ test / test-react-latest-dist (push) Has been skipped
✅ test / test lib/es module (push) Failing after 55s
👁️ Visual Regression Persist Start / test image (push) Failing after 56s
Publish Any Commit / build (push) Failing after 55s
🔀 Sync mirror to Gitee / mirror (push) Has been skipped
✅ test / lint (push) Failing after 55s
✅ test / test-react-latest (push) Failing after 58s
✅ test / test-coverage (push) Has been skipped
✅ test / build (push) Failing after 55s

* chore: fix biome error

* fix

* fix again

* revert
This commit is contained in:
thinkasany 2025-08-14 22:52:15 +08:00 committed by GitHub
parent ba42d6842d
commit 5e7f63fb30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 64 additions and 49 deletions

View file

@ -145,7 +145,7 @@ export default defineConfig({
} }
}`, }`,
// .gitignore // .gitignore
[`.gitignore`]: `# Logs '.gitignore': `# Logs
logs logs
*.log *.log
npm-debug.log* npm-debug.log*
@ -159,7 +159,7 @@ dist
dist-ssr dist-ssr
*.local`, *.local`,
// eslint.config.js // eslint.config.js
[`eslint.config.js`]: `import js from '@eslint/js' 'eslint.config.js': `import js from '@eslint/js'
import globals from 'globals' import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks' import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh' import reactRefresh from 'eslint-plugin-react-refresh'

View file

@ -8,9 +8,7 @@ interface ContributorAvatarProps {
} }
const ContributorAvatar: React.FC<ContributorAvatarProps> = (props) => { const ContributorAvatar: React.FC<ContributorAvatarProps> = (props) => {
const { const { item: { username, url } = {} } = props;
item: { username, url } = {},
} = props;
if (username?.includes('github-actions')) { if (username?.includes('github-actions')) {
return null; return null;
} }

View file

@ -47,9 +47,12 @@
"complexity": { "complexity": {
"noUselessTypeConstraint": "off", "noUselessTypeConstraint": "off",
"noForEach": "off", "noForEach": "off",
"useDateNow": "off" "useDateNow": "off",
"noImportantStyles": "off",
"useIndexOf": "off"
}, },
"correctness": { "correctness": {
"useUniqueElementIds": "off",
"useExhaustiveDependencies": "off", "useExhaustiveDependencies": "off",
"useHookAtTopLevel": "off", "useHookAtTopLevel": "off",
"noUnusedFunctionParameters": "off", "noUnusedFunctionParameters": "off",
@ -62,7 +65,9 @@
"noArrayIndexKey": "off", "noArrayIndexKey": "off",
"noConfusingVoidType": "off", "noConfusingVoidType": "off",
"noThenProperty": "off", "noThenProperty": "off",
"noTemplateCurlyInString": "off" "noTemplateCurlyInString": "off",
"useIterableCallbackReturn": "off",
"noUnknownAtRules": "off"
}, },
"performance": { "performance": {
"noDelete": "off", "noDelete": "off",
@ -78,9 +83,6 @@
"noStaticElementInteractions": "off", "noStaticElementInteractions": "off",
"useAriaPropsSupportedByRole": "off", "useAriaPropsSupportedByRole": "off",
"useAriaPropsForRole": "off" "useAriaPropsForRole": "off"
},
"nursery": {
"useUniqueElementIds": "off"
} }
} }
}, },

View file

@ -1,3 +1,4 @@
const isPrimitive = (value: unknown) => (typeof value !== 'object' && typeof value !== 'function') || value === null; const isPrimitive = (value: unknown) =>
(typeof value !== 'object' && typeof value !== 'function') || value === null;
export default isPrimitive; export default isPrimitive;

View file

@ -268,6 +268,8 @@ describe('Badge', () => {
// styles // styles
expect(element).toHaveStyle({ backgroundColor: 'rgb(255, 255, 0)' }); expect(element).toHaveStyle({ backgroundColor: 'rgb(255, 255, 0)' });
expect(element?.querySelector<HTMLElement>('sup')).toHaveStyle({ backgroundColor: 'rgb(0, 0, 255)' }); expect(element?.querySelector<HTMLElement>('sup')).toHaveStyle({
backgroundColor: 'rgb(0, 0, 255)',
});
}); });
}); });

View file

@ -57,6 +57,6 @@ const ButtonGroup: React.FC<ButtonGroupProps> = (props) => {
<div {...others} className={classes} /> <div {...others} className={classes} />
</GroupSizeContext.Provider> </GroupSizeContext.Provider>
); );
} };
export default ButtonGroup; export default ButtonGroup;

View file

@ -427,7 +427,9 @@ describe('DatePicker', () => {
expect(errSpy).toHaveBeenCalledWith( expect(errSpy).toHaveBeenCalledWith(
'Warning: [antd: DatePicker] `popupStyle` is deprecated. Please use `styles.popup.root` instead.', 'Warning: [antd: DatePicker] `popupStyle` is deprecated. Please use `styles.popup.root` instead.',
); );
expect(container.querySelector('.ant-picker-dropdown')).toHaveStyle('background-color: rgb(255, 0, 0)'); expect(container.querySelector('.ant-picker-dropdown')).toHaveStyle(
'background-color: rgb(255, 0, 0)',
);
errSpy.mockRestore(); errSpy.mockRestore();
}); });

View file

@ -179,7 +179,9 @@ describe('RangePicker', () => {
expect(errSpy).toHaveBeenCalledWith( expect(errSpy).toHaveBeenCalledWith(
'Warning: [antd: DatePicker.RangePicker] `popupStyle` is deprecated. Please use `styles.popup.root` instead.', 'Warning: [antd: DatePicker.RangePicker] `popupStyle` is deprecated. Please use `styles.popup.root` instead.',
); );
expect(container.querySelector('.ant-picker-dropdown')).toHaveStyle('background-color: rgb(255, 0, 0)'); expect(container.querySelector('.ant-picker-dropdown')).toHaveStyle(
'background-color: rgb(255, 0, 0)',
);
errSpy.mockRestore(); errSpy.mockRestore();
}); });

View file

@ -1,7 +1,12 @@
import { unit } from '@ant-design/cssinjs'; import { unit } from '@ant-design/cssinjs';
import type { CSSObject } from '@ant-design/cssinjs'; import type { CSSObject } from '@ant-design/cssinjs';
import { genBorderlessStyle, genFilledStyle, genOutlinedStyle, genUnderlinedStyle } from '../../input/style/variants'; import {
genBorderlessStyle,
genFilledStyle,
genOutlinedStyle,
genUnderlinedStyle,
} from '../../input/style/variants';
import type { PickerToken } from './token'; import type { PickerToken } from './token';
const genVariantsStyle = (token: PickerToken): CSSObject => { const genVariantsStyle = (token: PickerToken): CSSObject => {

View file

@ -50,7 +50,7 @@ const ErrorList: React.FC<ErrorListProps> = ({
fieldId, fieldId,
onVisibleChanged, onVisibleChanged,
}) => { }) => {
const { prefixCls } = React.useContext(FormItemPrefixContext); const { prefixCls } = React.useContext(FormItemPrefixContext);
const baseClassName = `${prefixCls}-item-explain`; const baseClassName = `${prefixCls}-item-explain`;
@ -91,11 +91,11 @@ const ErrorList: React.FC<ErrorListProps> = ({
})); }));
}, [fullKeyList]); }, [fullKeyList]);
const helpProps: { id?: string } = { }; const helpProps: { id?: string } = {};
if (fieldId) { if (fieldId) {
helpProps.id = `${fieldId}_help`; helpProps.id = `${fieldId}_help`;
} }
return wrapCSSVar( return wrapCSSVar(
<CSSMotion <CSSMotion

View file

@ -64,7 +64,10 @@ const App: React.FC = () => {
) => ( ) => (
<Space size={12} className="toolbar-wrapper"> <Space size={12} className="toolbar-wrapper">
<LeftOutlined disabled={current === 0} onClick={() => onActive?.(-1)} /> <LeftOutlined disabled={current === 0} onClick={() => onActive?.(-1)} />
<RightOutlined disabled={current === imageList.length - 1} onClick={() => onActive?.(1)} /> <RightOutlined
disabled={current === imageList.length - 1}
onClick={() => onActive?.(1)}
/>
<DownloadOutlined onClick={onDownload} /> <DownloadOutlined onClick={onDownload} />
<SwapOutlined rotate={90} onClick={onFlipY} /> <SwapOutlined rotate={90} onClick={onFlipY} />
<SwapOutlined onClick={onFlipX} /> <SwapOutlined onClick={onFlipX} />

View file

@ -276,7 +276,9 @@ describe('List Item Layout', () => {
<List itemLayout="vertical" dataSource={dataSource} renderItem={(item) => getItem(item)} />, <List itemLayout="vertical" dataSource={dataSource} renderItem={(item) => getItem(item)} />,
</ConfigProvider>, </ConfigProvider>,
); );
expect(container.querySelector('.ant-list-item-extra')!).toHaveStyle('color: rgb(255, 192, 203)'); expect(container.querySelector('.ant-list-item-extra')!).toHaveStyle(
'color: rgb(255, 192, 203)',
);
expect(container.querySelector('.ant-list-item-action')!).toHaveStyle('color: rgb(0, 128, 0)'); expect(container.querySelector('.ant-list-item-action')!).toHaveStyle('color: rgb(0, 128, 0)');
expect(container.querySelector('.ant-list-item-extra')!).toHaveClass( expect(container.querySelector('.ant-list-item-extra')!).toHaveClass(

View file

@ -78,7 +78,7 @@ const localeValues: Locale = {
copy: 'Kopyala', copy: 'Kopyala',
copied: 'Kopyalandı', copied: 'Kopyalandı',
expand: 'Genişlet', expand: 'Genişlet',
collapse: 'Daralt' collapse: 'Daralt',
}, },
Form: { Form: {
optional: '(opsiyonel)', optional: '(opsiyonel)',

View file

@ -112,13 +112,13 @@ function wrapperDecorations(
const ELLIPSIS_STR = '...'; const ELLIPSIS_STR = '...';
const DECORATION_PROPS = [ const DECORATION_PROPS = [
'delete', 'delete',
'mark', 'mark',
'code', 'code',
'underline', 'underline',
'strong', 'strong',
'keyboard', 'keyboard',
'italic' 'italic',
] as const; ] as const;
const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => { const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
@ -466,13 +466,13 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
onEllipsis={onJsEllipsis} onEllipsis={onJsEllipsis}
expanded={expanded} expanded={expanded}
miscDeps={[ miscDeps={[
copied, copied,
expanded, expanded,
copyLoading, copyLoading,
enableEdit, enableEdit,
enableCopy, enableCopy,
textLocale, textLocale,
...DECORATION_PROPS.map(key => props[key as keyof BlockProps]) ...DECORATION_PROPS.map((key) => props[key as keyof BlockProps]),
]} ]}
> >
{(node, canEllipsis) => {(node, canEllipsis) =>

View file

@ -161,7 +161,6 @@ describe('Upload List', () => {
it('should be uploading when upload a file', async () => { it('should be uploading when upload a file', async () => {
const done = jest.fn(); const done = jest.fn();
// biome-ignore lint/style/useConst: test only
let wrapper: ReturnType<typeof render>; let wrapper: ReturnType<typeof render>;
let latestFileList: UploadFile<any>[] | null = null; let latestFileList: UploadFile<any>[] | null = null;
const onChange: UploadProps['onChange'] = async ({ file, fileList: eventFileList }) => { const onChange: UploadProps['onChange'] = async ({ file, fileList: eventFileList }) => {
@ -1201,7 +1200,6 @@ describe('Upload List', () => {
it('should render <img /> when upload non-image file and configure thumbUrl in onChange', async () => { it('should render <img /> when upload non-image file and configure thumbUrl in onChange', async () => {
const thumbUrl = const thumbUrl =
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png'; 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png';
// biome-ignore lint/style/useConst: test only
let wrapper: ReturnType<typeof render>; let wrapper: ReturnType<typeof render>;
const onChange = jest.fn<void, Record<'fileList', UploadProps['fileList']>[]>( const onChange = jest.fn<void, Record<'fileList', UploadProps['fileList']>[]>(
({ fileList: files }) => { ({ fileList: files }) => {
@ -1258,7 +1256,6 @@ describe('Upload List', () => {
it('should not render <img /> when upload non-image file without thumbUrl in onChange', async () => { it('should not render <img /> when upload non-image file without thumbUrl in onChange', async () => {
(global as any).testName = (global as any).testName =
'should not render <img /> when upload non-image file without thumbUrl in onChange'; 'should not render <img /> when upload non-image file without thumbUrl in onChange';
// biome-ignore lint/style/useConst: test only
let wrapper: ReturnType<typeof render>; let wrapper: ReturnType<typeof render>;
const onChange = jest.fn<void, Record<'fileList', UploadProps['fileList']>[]>( const onChange = jest.fn<void, Record<'fileList', UploadProps['fileList']>[]>(
({ fileList: files }) => { ({ fileList: files }) => {
@ -1302,7 +1299,6 @@ describe('Upload List', () => {
it('[deprecated] should support transformFile', (done) => { it('[deprecated] should support transformFile', (done) => {
jest.useRealTimers(); jest.useRealTimers();
// biome-ignore lint/style/useConst: test only
let wrapper: ReturnType<typeof render>; let wrapper: ReturnType<typeof render>;
let lastFile: UploadFile; let lastFile: UploadFile;

View file

@ -28,12 +28,14 @@ class MockPortal extends React.Component<React.PropsWithChildren> {
} }
} }
const CustomPortal = React.forwardRef<PortalRef, PortalProps | React.PropsWithChildren>((props, ref) => { const CustomPortal = React.forwardRef<PortalRef, PortalProps | React.PropsWithChildren>(
const context = React.useContext(TriggerMockContext); (props, ref) => {
if (context?.mock === false) { const context = React.useContext(TriggerMockContext);
return <OriginPortal {...props} ref={ref} />; if (context?.mock === false) {
} return <OriginPortal {...props} ref={ref} />;
return <MockPortal {...props} />; }
}); return <MockPortal {...props} />;
},
);
export default CustomPortal; export default CustomPortal;

View file

@ -62,7 +62,7 @@ function addPluginsForProduction(config) {
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined, enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: 'antd.min', bundleName: 'antd.min',
uploadToken: process.env.CODECOV_TOKEN, uploadToken: process.env.CODECOV_TOKEN,
gitService: "github", gitService: 'github',
}), }),
new CircularDependencyPlugin({ new CircularDependencyPlugin({
failOnError: true, failOnError: true,