mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-22 08:47:10 +08:00
feat: bump eslint & oxlint (#14452)
#### PR Dependency Tree * **PR #14452** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved null-safety, dependency tracking, upload validation, and error logging for more reliable uploads, clipboard, calendar linking, telemetry, PDF/theme printing, and preview/zoom behavior. * Tightened handling of all-day calendar events (missing date now reported). * **Deprecations** * Removed deprecated RadioButton and RadioButtonGroup; use RadioGroup. * **Chores** * Unified and upgraded linting/config, reorganized imports, and standardized binary handling for more consistent builds and tooling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -24,7 +24,7 @@ export function useDisposable<T extends Disposable | AsyncDisposable>(
|
||||
error: null,
|
||||
});
|
||||
|
||||
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
useEffect(() => {
|
||||
const abortController = new AbortController();
|
||||
let _data: T | null = null;
|
||||
@@ -54,7 +54,7 @@ export function useDisposable<T extends Disposable | AsyncDisposable>(
|
||||
}
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
}, deps || []);
|
||||
|
||||
return state;
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
*/
|
||||
import { useDebugValue, useEffect, useState } from 'react';
|
||||
|
||||
// internalRef is used as a reference and therefore save to be used inside an effect
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
|
||||
// the `process.env.NODE_ENV !== 'production'` condition is resolved by the build tool
|
||||
|
||||
const noop: (...args: any[]) => any = () => {};
|
||||
@@ -84,6 +81,7 @@ export const useRefEffect = <T>(
|
||||
}
|
||||
};
|
||||
}, // Keep a ref to the latest dependencies
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
(internalRef.dependencies_ = dependencies)
|
||||
);
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
export * from './button';
|
||||
export * from './dropdown-button';
|
||||
export * from './icon-button';
|
||||
export * from './radio';
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
import type {
|
||||
RadioGroupItemProps,
|
||||
RadioGroupProps,
|
||||
} from '@radix-ui/react-radio-group';
|
||||
import * as RadixRadioGroup from '@radix-ui/react-radio-group';
|
||||
import clsx from 'clsx';
|
||||
import type { CSSProperties } from 'react';
|
||||
import { forwardRef } from 'react';
|
||||
|
||||
import { RadioGroup } from '../radio';
|
||||
import * as styles from './styles.css';
|
||||
|
||||
// for reference
|
||||
RadioGroup;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* use {@link RadioGroup } instead
|
||||
*/
|
||||
export const RadioButton = forwardRef<
|
||||
HTMLButtonElement,
|
||||
RadioGroupItemProps & { spanStyle?: string }
|
||||
>(({ children, className, spanStyle, ...props }, ref) => {
|
||||
return (
|
||||
<RadixRadioGroup.Item
|
||||
ref={ref}
|
||||
{...props}
|
||||
className={clsx(styles.radioButton, className)}
|
||||
>
|
||||
<span className={clsx(styles.radioUncheckedButton, spanStyle)}>
|
||||
{children}
|
||||
</span>
|
||||
<RadixRadioGroup.Indicator
|
||||
className={clsx(styles.radioButtonContent, spanStyle)}
|
||||
>
|
||||
{children}
|
||||
</RadixRadioGroup.Indicator>
|
||||
</RadixRadioGroup.Item>
|
||||
);
|
||||
});
|
||||
RadioButton.displayName = 'RadioButton';
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* use {@link RadioGroup} instead
|
||||
*/
|
||||
export const RadioButtonGroup = forwardRef<
|
||||
HTMLDivElement,
|
||||
RadioGroupProps & { width?: CSSProperties['width'] }
|
||||
>(({ className, style, width, ...props }, ref) => {
|
||||
return (
|
||||
<RadixRadioGroup.Root
|
||||
ref={ref}
|
||||
className={clsx(styles.radioButtonGroup, className)}
|
||||
style={{ width, ...style }}
|
||||
{...props}
|
||||
></RadixRadioGroup.Root>
|
||||
);
|
||||
});
|
||||
RadioButtonGroup.displayName = 'RadioButtonGroup';
|
||||
@@ -1,5 +1,6 @@
|
||||
import { cssVar } from '@toeverything/theme';
|
||||
import { style } from '@vanilla-extract/css';
|
||||
|
||||
export const dropdownBtn = style({
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
@@ -30,6 +31,7 @@ export const dropdownBtn = style({
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const divider = style({
|
||||
width: '0.5px',
|
||||
height: '16px',
|
||||
@@ -38,6 +40,7 @@ export const divider = style({
|
||||
margin: '0 4px',
|
||||
marginRight: 0,
|
||||
});
|
||||
|
||||
export const dropdownWrapper = style({
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
@@ -47,6 +50,7 @@ export const dropdownWrapper = style({
|
||||
paddingLeft: '4px',
|
||||
paddingRight: '10px',
|
||||
});
|
||||
|
||||
export const dropdownIcon = style({
|
||||
borderRadius: '4px',
|
||||
selectors: {
|
||||
@@ -55,55 +59,3 @@ export const dropdownIcon = style({
|
||||
},
|
||||
},
|
||||
});
|
||||
export const radioButton = style({
|
||||
flexGrow: 1,
|
||||
flex: 1,
|
||||
selectors: {
|
||||
'&:not(:last-of-type)': {
|
||||
marginRight: '4px',
|
||||
},
|
||||
},
|
||||
});
|
||||
export const radioButtonContent = style({
|
||||
fontSize: cssVar('fontXs'),
|
||||
display: 'flex',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
height: '28px',
|
||||
padding: '4px 8px',
|
||||
borderRadius: '8px',
|
||||
filter: 'drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.1))',
|
||||
whiteSpace: 'nowrap',
|
||||
userSelect: 'none',
|
||||
fontWeight: 600,
|
||||
selectors: {
|
||||
'&:hover': {
|
||||
background: cssVar('hoverColor'),
|
||||
},
|
||||
'&[data-state="checked"]': {
|
||||
background: cssVar('white'),
|
||||
},
|
||||
},
|
||||
});
|
||||
export const radioUncheckedButton = style([
|
||||
radioButtonContent,
|
||||
{
|
||||
color: cssVar('textSecondaryColor'),
|
||||
filter: 'none',
|
||||
selectors: {
|
||||
'[data-state="checked"] > &': {
|
||||
display: 'none',
|
||||
},
|
||||
},
|
||||
},
|
||||
]);
|
||||
export const radioButtonGroup = style({
|
||||
display: 'inline-flex',
|
||||
justifyContent: 'space-between',
|
||||
alignItems: 'center',
|
||||
background: cssVar('hoverColorFilled'),
|
||||
borderRadius: '10px',
|
||||
padding: '2px',
|
||||
// @ts-expect-error - fix electron drag
|
||||
WebkitAppRegion: 'no-drag',
|
||||
});
|
||||
|
||||
@@ -46,7 +46,7 @@ export const DatePicker = (props: DatePickerProps) => {
|
||||
setCursor(dayjs(v));
|
||||
onChange?.(v);
|
||||
},
|
||||
[onChange]
|
||||
[setMode, onChange]
|
||||
);
|
||||
|
||||
const onCursorChange = useCallback(
|
||||
|
||||
@@ -83,7 +83,7 @@ export const useDraggable = <D extends DNDData = DNDData>(
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
}, [...deps, getOptions, context.toExternalData]);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -206,7 +206,7 @@ export const useDropTarget = <D extends DNDData = DNDData>(
|
||||
(dropTargetContext.fromExternalData as fromExternalData<D>))
|
||||
: undefined,
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
}, [...deps, getOptions, dropTargetContext.fromExternalData]);
|
||||
|
||||
const getDropTargetOptions = useCallback(() => {
|
||||
|
||||
@@ -94,7 +94,7 @@ export const useDndMonitor = <D extends DNDData = DNDData>(
|
||||
(dropTargetContext.fromExternalData as fromExternalData<D>))
|
||||
: undefined,
|
||||
};
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
}, [...deps, getOptions, dropTargetContext.fromExternalData]);
|
||||
|
||||
const monitorOptions = useMemo(() => {
|
||||
|
||||
@@ -93,15 +93,15 @@ export const InlineEdit = ({
|
||||
const [editingValue, setEditingValue] = useState(value);
|
||||
const inputRef = useRef<HTMLInputElement>(null);
|
||||
|
||||
useImperativeHandle<InlineEditHandle, InlineEditHandle>(handleRef, () => ({
|
||||
triggerEdit,
|
||||
}));
|
||||
|
||||
const triggerEdit = useCallback(() => {
|
||||
if (!editable) return;
|
||||
setEditing(true);
|
||||
}, [editable]);
|
||||
|
||||
useImperativeHandle<InlineEditHandle, InlineEditHandle>(handleRef, () => ({
|
||||
triggerEdit,
|
||||
}));
|
||||
|
||||
const onDoubleClick = useCallback(() => {
|
||||
if (trigger !== 'doubleClick') return;
|
||||
triggerEdit();
|
||||
|
||||
@@ -69,7 +69,7 @@ export const RowInput = forwardRef<HTMLInputElement, RowInputProps>(
|
||||
if (!onBlur) return;
|
||||
selectRef.current?.addEventListener('blur', onBlur as any);
|
||||
return () => {
|
||||
// oxlint-disable-next-line react-hooks/exhaustive-deps
|
||||
// oxlint-disable-next-line react/exhaustive-deps
|
||||
selectRef.current?.removeEventListener('blur', onBlur as any);
|
||||
};
|
||||
}, [onBlur, selectRef]);
|
||||
|
||||
Reference in New Issue
Block a user