mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-08 18:39:20 +08:00
chore: unified code style (#55406)
This commit is contained in:
@@ -20,7 +20,9 @@
|
||||
|
||||
const isEnabled = always || enabledCondition.every(Boolean);
|
||||
|
||||
if (!isEnabled) return;
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const prefixCls = 'antd-mirror-notify';
|
||||
const primaryColor = '#1677ff';
|
||||
|
||||
@@ -39,7 +39,9 @@ jobs:
|
||||
const now = new Date();
|
||||
|
||||
for (const issue of issues) {
|
||||
if (issue.pull_request) continue;
|
||||
if (issue.pull_request) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const updatedAt = new Date(issue.updated_at);
|
||||
const daysInactive = (now - updatedAt) / (1000 * 60 * 60 * 24);
|
||||
|
||||
@@ -176,7 +176,9 @@ const Alert = React.forwardRef<AlertRef, AlertProps>((props, ref) => {
|
||||
|
||||
// closeable when closeText or closeIcon is assigned
|
||||
const isClosable = React.useMemo<boolean>(() => {
|
||||
if (typeof closable === 'object' && closable.closeIcon) return true;
|
||||
if (typeof closable === 'object' && closable.closeIcon) {
|
||||
return true;
|
||||
}
|
||||
if (closeText) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -65,8 +65,12 @@ const App: React.FC = () => {
|
||||
};
|
||||
|
||||
const cellRender: CalendarProps<Dayjs>['cellRender'] = (current, info) => {
|
||||
if (info.type === 'date') return dateCellRender(current);
|
||||
if (info.type === 'month') return monthCellRender(current);
|
||||
if (info.type === 'date') {
|
||||
return dateCellRender(current);
|
||||
}
|
||||
if (info.type === 'month') {
|
||||
return monthCellRender(current);
|
||||
}
|
||||
return info.originNode;
|
||||
};
|
||||
|
||||
|
||||
@@ -13,8 +13,12 @@ const PickerWithType = ({
|
||||
type: PickerType;
|
||||
onChange: TimePickerProps['onChange'] | DatePickerProps['onChange'];
|
||||
}) => {
|
||||
if (type === 'time') return <TimePicker onChange={onChange} />;
|
||||
if (type === 'date') return <DatePicker onChange={onChange} />;
|
||||
if (type === 'time') {
|
||||
return <TimePicker onChange={onChange} />;
|
||||
}
|
||||
if (type === 'date') {
|
||||
return <DatePicker onChange={onChange} />;
|
||||
}
|
||||
return <DatePicker picker={type} onChange={onChange} />;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@ const formItemNameBlackList = ['parentNode'];
|
||||
const defaultItemNamePrefixCls: string = 'form_item';
|
||||
|
||||
export function toArray<T>(candidate?: T | T[] | false): T[] {
|
||||
if (candidate === undefined || candidate === false) return [];
|
||||
|
||||
if (candidate === undefined || candidate === false) {
|
||||
return [];
|
||||
}
|
||||
return Array.isArray(candidate) ? candidate : [candidate];
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,9 @@ const App: React.FC = () => {
|
||||
fetch(`https://api.github.com/search/users?q=${key}`)
|
||||
.then((res) => res.json())
|
||||
.then(({ items = [] }) => {
|
||||
if (ref.current !== key) return;
|
||||
|
||||
if (ref.current !== key) {
|
||||
return;
|
||||
}
|
||||
setLoading(false);
|
||||
setUsers(items.slice(0, 10));
|
||||
});
|
||||
|
||||
@@ -39,7 +39,9 @@ const App: React.FC = () => {
|
||||
};
|
||||
|
||||
const remove = (targetKey: TargetKey) => {
|
||||
if (!items) return;
|
||||
if (!items) {
|
||||
return;
|
||||
}
|
||||
const targetIndex = items.findIndex((item) => item.key === targetKey);
|
||||
const newItems = items.filter((item) => item.key !== targetKey);
|
||||
|
||||
|
||||
@@ -22,13 +22,23 @@ const TimelineItemList: React.FC<TimelineProps & { hashId: string; direction?: s
|
||||
}) => {
|
||||
const getPositionCls = (position: string, idx: number) => {
|
||||
if (mode === 'alternate') {
|
||||
if (position === 'right') return `${prefixCls}-item-right`;
|
||||
if (position === 'left') return `${prefixCls}-item-left`;
|
||||
if (position === 'right') {
|
||||
return `${prefixCls}-item-right`;
|
||||
}
|
||||
if (position === 'left') {
|
||||
return `${prefixCls}-item-left`;
|
||||
}
|
||||
return idx % 2 === 0 ? `${prefixCls}-item-left` : `${prefixCls}-item-right`;
|
||||
}
|
||||
if (mode === 'left') return `${prefixCls}-item-left`;
|
||||
if (mode === 'right') return `${prefixCls}-item-right`;
|
||||
if (position === 'right') return `${prefixCls}-item-right`;
|
||||
if (mode === 'left') {
|
||||
return `${prefixCls}-item-left`;
|
||||
}
|
||||
if (mode === 'right') {
|
||||
return `${prefixCls}-item-right`;
|
||||
}
|
||||
if (position === 'right') {
|
||||
return `${prefixCls}-item-right`;
|
||||
}
|
||||
return '';
|
||||
};
|
||||
const mergedItems = [...(items || [])];
|
||||
|
||||
@@ -76,8 +76,9 @@ const Editable: React.FC<EditableProps> = (props) => {
|
||||
|
||||
const onKeyDown: React.KeyboardEventHandler<HTMLTextAreaElement> = ({ keyCode }) => {
|
||||
// We don't record keyCode when IME is using
|
||||
if (inComposition.current) return;
|
||||
|
||||
if (inComposition.current) {
|
||||
return;
|
||||
}
|
||||
lastKeyCode.current = keyCode;
|
||||
};
|
||||
|
||||
|
||||
@@ -249,7 +249,9 @@ export default function Page() {
|
||||
queryClient.invalidateQueries({ queryKey: ['products'] });
|
||||
},
|
||||
});
|
||||
if (productsQuery.isLoading) return null;
|
||||
if (productsQuery.isLoading) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<h1 className={styles.title}>Page products</h1>
|
||||
|
||||
@@ -249,7 +249,9 @@ export default function Page() {
|
||||
queryClient.invalidateQueries({ queryKey: ['products'] });
|
||||
},
|
||||
});
|
||||
if (productsQuery.isLoading) return null;
|
||||
if (productsQuery.isLoading) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div>
|
||||
<h1 className={styles.title}>Page products</h1>
|
||||
|
||||
Reference in New Issue
Block a user