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`]: `# Logs
'.gitignore': `# Logs
logs
*.log
npm-debug.log*
@ -159,7 +159,7 @@ dist
dist-ssr
*.local`,
// eslint.config.js
[`eslint.config.js`]: `import js from '@eslint/js'
'eslint.config.js': `import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

View file

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

View file

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

View file

@ -268,6 +268,8 @@ describe('Badge', () => {
// styles
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} />
</GroupSizeContext.Provider>
);
}
};
export default ButtonGroup;

View file

@ -427,7 +427,9 @@ describe('DatePicker', () => {
expect(errSpy).toHaveBeenCalledWith(
'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();
});

View file

@ -179,7 +179,9 @@ describe('RangePicker', () => {
expect(errSpy).toHaveBeenCalledWith(
'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();
});

View file

@ -1,7 +1,12 @@
import { unit } 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';
const genVariantsStyle = (token: PickerToken): CSSObject => {

View file

@ -91,7 +91,7 @@ const ErrorList: React.FC<ErrorListProps> = ({
}));
}, [fullKeyList]);
const helpProps: { id?: string } = { };
const helpProps: { id?: string } = {};
if (fieldId) {
helpProps.id = `${fieldId}_help`;

View file

@ -64,7 +64,10 @@ const App: React.FC = () => {
) => (
<Space size={12} className="toolbar-wrapper">
<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} />
<SwapOutlined rotate={90} onClick={onFlipY} />
<SwapOutlined onClick={onFlipX} />

View file

@ -276,7 +276,9 @@ describe('List Item Layout', () => {
<List itemLayout="vertical" dataSource={dataSource} renderItem={(item) => getItem(item)} />,
</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-extra')!).toHaveClass(

View file

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

View file

@ -118,7 +118,7 @@ const DECORATION_PROPS = [
'underline',
'strong',
'keyboard',
'italic'
'italic',
] as const;
const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
@ -472,7 +472,7 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
enableEdit,
enableCopy,
textLocale,
...DECORATION_PROPS.map(key => props[key as keyof BlockProps])
...DECORATION_PROPS.map((key) => props[key as keyof BlockProps]),
]}
>
{(node, canEllipsis) =>

View file

@ -161,7 +161,6 @@ describe('Upload List', () => {
it('should be uploading when upload a file', async () => {
const done = jest.fn();
// biome-ignore lint/style/useConst: test only
let wrapper: ReturnType<typeof render>;
let latestFileList: UploadFile<any>[] | null = null;
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 () => {
const thumbUrl =
'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png';
// biome-ignore lint/style/useConst: test only
let wrapper: ReturnType<typeof render>;
const onChange = jest.fn<void, Record<'fileList', UploadProps['fileList']>[]>(
({ fileList: files }) => {
@ -1258,7 +1256,6 @@ describe('Upload List', () => {
it('should not render <img /> when upload non-image file without thumbUrl in onChange', async () => {
(global as any).testName =
'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>;
const onChange = jest.fn<void, Record<'fileList', UploadProps['fileList']>[]>(
({ fileList: files }) => {
@ -1302,7 +1299,6 @@ describe('Upload List', () => {
it('[deprecated] should support transformFile', (done) => {
jest.useRealTimers();
// biome-ignore lint/style/useConst: test only
let wrapper: ReturnType<typeof render>;
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>(
(props, ref) => {
const context = React.useContext(TriggerMockContext);
if (context?.mock === false) {
return <OriginPortal {...props} ref={ref} />;
}
return <MockPortal {...props} />;
});
},
);
export default CustomPortal;

View file

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