mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-09 21:25:45 +08:00
chore: upgrade oxlint to v0.13.2 (#8891)
Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
+12
-1
@@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||||
|
"plugins": ["import", "react", "typescript", "unicorn", "promise"],
|
||||||
"categories": {
|
"categories": {
|
||||||
"correctness": "error",
|
"correctness": "error",
|
||||||
"perf": "error"
|
"perf": "error"
|
||||||
@@ -7,6 +9,7 @@
|
|||||||
// allow
|
// allow
|
||||||
"import/named": "allow",
|
"import/named": "allow",
|
||||||
"no-await-in-loop": "allow",
|
"no-await-in-loop": "allow",
|
||||||
|
"promise/no-callback-in-promise": "allow",
|
||||||
// deny
|
// deny
|
||||||
"unicorn/prefer-array-some": "error",
|
"unicorn/prefer-array-some": "error",
|
||||||
"unicorn/no-useless-promise-resolve-reject": "error",
|
"unicorn/no-useless-promise-resolve-reject": "error",
|
||||||
@@ -16,5 +19,13 @@
|
|||||||
"ignoreTypes": true
|
"ignoreTypes": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.stories.tsx"],
|
||||||
|
"rules": {
|
||||||
|
"react/no-array-index-key": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -29,7 +29,7 @@
|
|||||||
"lint:eslint:fix": "yarn lint:eslint --fix",
|
"lint:eslint:fix": "yarn lint:eslint --fix",
|
||||||
"lint:prettier": "prettier --ignore-unknown --cache --check .",
|
"lint:prettier": "prettier --ignore-unknown --cache --check .",
|
||||||
"lint:prettier:fix": "prettier --ignore-unknown --cache --write .",
|
"lint:prettier:fix": "prettier --ignore-unknown --cache --write .",
|
||||||
"lint:ox": "oxlint -c oxlint.json --deny-warnings --import-plugin",
|
"lint:ox": "oxlint -c oxlint.json --deny-warnings",
|
||||||
"lint": "yarn lint:eslint && yarn lint:prettier",
|
"lint": "yarn lint:eslint && yarn lint:prettier",
|
||||||
"lint:fix": "yarn lint:eslint:fix && yarn lint:prettier:fix",
|
"lint:fix": "yarn lint:eslint:fix && yarn lint:prettier:fix",
|
||||||
"test": "vitest --run",
|
"test": "vitest --run",
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
"msw": "^2.3.0",
|
"msw": "^2.3.0",
|
||||||
"nx": "^20.0.3",
|
"nx": "^20.0.3",
|
||||||
"nx-cloud": "^19.1.0",
|
"nx-cloud": "^19.1.0",
|
||||||
"oxlint": "0.12.0",
|
"oxlint": "0.13.2",
|
||||||
"prettier": "^3.3.3",
|
"prettier": "^3.3.3",
|
||||||
"semver": "^7.6.0",
|
"semver": "^7.6.0",
|
||||||
"serve": "^14.2.1",
|
"serve": "^14.2.1",
|
||||||
|
|||||||
@@ -94,10 +94,8 @@ export function unregisterCopilotProvider(type: CopilotProviderType) {
|
|||||||
|
|
||||||
/// Asserts that the config is valid for any registered providers
|
/// Asserts that the config is valid for any registered providers
|
||||||
export function assertProvidersConfigs(config: AFFiNEConfig) {
|
export function assertProvidersConfigs(config: AFFiNEConfig) {
|
||||||
return (
|
return Array.from(ASSERT_CONFIG.values()).some(assertConfig =>
|
||||||
Array.from(ASSERT_CONFIG.values()).findIndex(assertConfig =>
|
assertConfig(config)
|
||||||
assertConfig(config)
|
|
||||||
) !== -1
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,10 +64,10 @@ export function decodeLookupKey(
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
const SubscriptionActivated: Stripe.Subscription.Status[] = [
|
const SubscriptionActivated: Set<Stripe.Subscription.Status> = new Set([
|
||||||
SubscriptionStatus.Active,
|
SubscriptionStatus.Active,
|
||||||
SubscriptionStatus.Trialing,
|
SubscriptionStatus.Trialing,
|
||||||
];
|
]);
|
||||||
|
|
||||||
export enum CouponType {
|
export enum CouponType {
|
||||||
ProEarlyAccessOneYearFree = 'pro_ea_one_year_free',
|
ProEarlyAccessOneYearFree = 'pro_ea_one_year_free',
|
||||||
@@ -750,7 +750,7 @@ export class SubscriptionService {
|
|||||||
|
|
||||||
const [plan, recurring, variant] =
|
const [plan, recurring, variant] =
|
||||||
this.decodePlanFromSubscription(subscription);
|
this.decodePlanFromSubscription(subscription);
|
||||||
const planActivated = SubscriptionActivated.includes(subscription.status);
|
const planActivated = SubscriptionActivated.has(subscription.status);
|
||||||
|
|
||||||
// update features first, features modify are idempotent
|
// update features first, features modify are idempotent
|
||||||
// so there is no need to skip if a subscription already exists.
|
// so there is no need to skip if a subscription already exists.
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export function EditPrompt({
|
|||||||
<div className="px-5 py-4 overflow-y-auto space-y-[10px] flex flex-col">
|
<div className="px-5 py-4 overflow-y-auto space-y-[10px] flex flex-col">
|
||||||
<div className="text-sm font-medium">Messages</div>
|
<div className="text-sm font-medium">Messages</div>
|
||||||
{messages.map((message, index) => (
|
{messages.map((message, index) => (
|
||||||
<div key={index} className="flex flex-col gap-3">
|
<div key={message.content} className="flex flex-col gap-3">
|
||||||
{index !== 0 && <Separator />}
|
{index !== 0 && <Separator />}
|
||||||
<div>
|
<div>
|
||||||
<div className="text-sm font-normal">Role</div>
|
<div className="text-sm font-normal">Role</div>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export function Prompts() {
|
|||||||
<div className="flex flex-col rounded-md border w-full">
|
<div className="flex flex-col rounded-md border w-full">
|
||||||
{list.map((item, index) => (
|
{list.map((item, index) => (
|
||||||
<PromptRow
|
<PromptRow
|
||||||
key={item.name.concat(index.toString())}
|
key={`${item.name}-${index}`}
|
||||||
item={item}
|
item={item}
|
||||||
index={index}
|
index={index}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -51,9 +51,9 @@ export const CollapsibleItem = ({
|
|||||||
</AccordionTrigger>
|
</AccordionTrigger>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<AccordionContent className=" flex flex-col gap-2 py-1">
|
<AccordionContent className=" flex flex-col gap-2 py-1">
|
||||||
{items.map((item, index) => (
|
{items.map(item => (
|
||||||
<NavLink
|
<NavLink
|
||||||
key={index}
|
key={item}
|
||||||
to={`/admin/settings/${title}#${item}`}
|
to={`/admin/settings/${title}#${item}`}
|
||||||
className={({ isActive }) => {
|
className={({ isActive }) => {
|
||||||
return isActive && activeSubTab === item
|
return isActive && activeSubTab === item
|
||||||
|
|||||||
@@ -213,7 +213,7 @@ export const Form = () => {
|
|||||||
<div className="py-2 px-0 text-sm mt-16 max-lg:mt-5 relative">
|
<div className="py-2 px-0 text-sm mt-16 max-lg:mt-5 relative">
|
||||||
{Array.from({ length: count }).map((_, index) => (
|
{Array.from({ length: count }).map((_, index) => (
|
||||||
<span
|
<span
|
||||||
key={index}
|
key={`${index}`}
|
||||||
className={`inline-block w-16 h-1 rounded mr-1 ${
|
className={`inline-block w-16 h-1 rounded mr-1 ${
|
||||||
index <= current - 1
|
index <= current - 1
|
||||||
? 'bg-primary'
|
? 'bg-primary'
|
||||||
|
|||||||
@@ -159,11 +159,11 @@ export const OnboardingPage = ({
|
|||||||
<div className={styles.optionsWrapper}>
|
<div className={styles.optionsWrapper}>
|
||||||
{question.options &&
|
{question.options &&
|
||||||
question.options.length > 0 &&
|
question.options.length > 0 &&
|
||||||
question.options.map((option, optionIndex) => {
|
question.options.map(option => {
|
||||||
if (option.type === 'checkbox') {
|
if (option.type === 'checkbox') {
|
||||||
return (
|
return (
|
||||||
<Checkbox
|
<Checkbox
|
||||||
key={optionIndex}
|
key={option.label}
|
||||||
name={option.value}
|
name={option.value}
|
||||||
className={styles.checkBox}
|
className={styles.checkBox}
|
||||||
labelClassName={styles.label}
|
labelClassName={styles.label}
|
||||||
@@ -184,7 +184,7 @@ export const OnboardingPage = ({
|
|||||||
} else if (option.type === 'input') {
|
} else if (option.type === 'input') {
|
||||||
return (
|
return (
|
||||||
<Input
|
<Input
|
||||||
key={optionIndex}
|
key={option.label}
|
||||||
className={styles.input}
|
className={styles.input}
|
||||||
type="text"
|
type="text"
|
||||||
size="large"
|
size="large"
|
||||||
|
|||||||
@@ -187,23 +187,27 @@ export const DayPicker = memo(function DayPicker(
|
|||||||
{/* Weeks in month */}
|
{/* Weeks in month */}
|
||||||
{matrix.map((week, i) => {
|
{matrix.map((week, i) => {
|
||||||
return (
|
return (
|
||||||
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
<div key={i} className={clsx(styles.monthViewRow)}>
|
<div key={i} className={clsx(styles.monthViewRow)}>
|
||||||
{week.map((cell, j) => (
|
{week.map(cell => {
|
||||||
<div
|
const dateValue = cell.date.format(format);
|
||||||
className={clsx(
|
return (
|
||||||
styles.monthViewBodyCell,
|
<div
|
||||||
monthBodyCellClassName
|
className={clsx(
|
||||||
)}
|
styles.monthViewBodyCell,
|
||||||
key={j}
|
monthBodyCellClassName
|
||||||
onClick={() => onChange?.(cell.date.format(format))}
|
)}
|
||||||
>
|
key={dateValue}
|
||||||
{customDayRenderer ? (
|
onClick={() => onChange?.(dateValue)}
|
||||||
customDayRenderer(cell)
|
>
|
||||||
) : (
|
{customDayRenderer ? (
|
||||||
<DefaultDateCell key={j} {...cell} />
|
customDayRenderer(cell)
|
||||||
)}
|
) : (
|
||||||
</div>
|
<DefaultDateCell key={dateValue} {...cell} />
|
||||||
))}
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ const HeaderLayout = memo(function HeaderLayout({
|
|||||||
const isRight = index === length - 1;
|
const isRight = index === length - 1;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
key={index}
|
key={index}
|
||||||
data-length={length}
|
data-length={length}
|
||||||
data-is-left={isLeft}
|
data-is-left={isLeft}
|
||||||
|
|||||||
@@ -126,21 +126,24 @@ export const MonthPicker = memo(function MonthPicker(
|
|||||||
const Body = useMemo(() => {
|
const Body = useMemo(() => {
|
||||||
return (
|
return (
|
||||||
<div className={styles.yearViewBody}>
|
<div className={styles.yearViewBody}>
|
||||||
|
{/* eslint-disable-next-line react/no-array-index-key */}
|
||||||
{matrix.map((row, i) => {
|
{matrix.map((row, i) => {
|
||||||
return (
|
return (
|
||||||
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
<div key={i} className={styles.yearViewRow}>
|
<div key={i} className={styles.yearViewRow}>
|
||||||
{row.map((month, j) => {
|
{row.map(month => {
|
||||||
|
const monthValue = month.format('YYYY-MM');
|
||||||
return (
|
return (
|
||||||
<div key={j} className={styles.yearViewBodyCell}>
|
<div key={monthValue} className={styles.yearViewBodyCell}>
|
||||||
<button
|
<button
|
||||||
data-value={month.format('YYYY-MM')}
|
data-value={monthValue}
|
||||||
data-is-month-cell
|
data-is-month-cell
|
||||||
className={styles.yearViewBodyCellInner}
|
className={styles.yearViewBodyCellInner}
|
||||||
data-selected={value && month.isSame(value, 'month')}
|
data-selected={value && month.isSame(value, 'month')}
|
||||||
data-current-month={month.isSame(dayjs(), 'month')}
|
data-current-month={month.isSame(dayjs(), 'month')}
|
||||||
onClick={() => onMonthChange(month)}
|
onClick={() => onMonthChange(month)}
|
||||||
tabIndex={month.isSame(monthCursor, 'month') ? 0 : -1}
|
tabIndex={month.isSame(monthCursor, 'month') ? 0 : -1}
|
||||||
aria-label={month.format('YYYY-MM')}
|
aria-label={monthValue}
|
||||||
>
|
>
|
||||||
{monthNames.split(',')[month.month()]}
|
{monthNames.split(',')[month.month()]}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -136,12 +136,14 @@ export const YearPicker = memo(function YearPicker(
|
|||||||
<div className={styles.decadeViewBody}>
|
<div className={styles.decadeViewBody}>
|
||||||
{matrix.map((row, i) => {
|
{matrix.map((row, i) => {
|
||||||
return (
|
return (
|
||||||
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
<div key={i} className={styles.decadeViewRow}>
|
<div key={i} className={styles.decadeViewRow}>
|
||||||
{row.map((year, j) => {
|
{row.map(year => {
|
||||||
const isDisabled =
|
const isDisabled =
|
||||||
year.isAfter(DATE_MAX) || year.isBefore(DATE_MIN);
|
year.isAfter(DATE_MAX) || year.isBefore(DATE_MIN);
|
||||||
|
const yearValue = year.year();
|
||||||
return (
|
return (
|
||||||
<div key={j} className={styles.decadeViewBodyCell}>
|
<div key={yearValue} className={styles.decadeViewBodyCell}>
|
||||||
<button
|
<button
|
||||||
aria-disabled={isDisabled}
|
aria-disabled={isDisabled}
|
||||||
data-value={year.format('YYYY')}
|
data-value={year.format('YYYY')}
|
||||||
@@ -154,7 +156,7 @@ export const YearPicker = memo(function YearPicker(
|
|||||||
isDisabled ? undefined : () => onYearChange(year)
|
isDisabled ? undefined : () => onYearChange(year)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{year.year()}
|
{yearValue}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export const Slider = ({
|
|||||||
{!!nodes &&
|
{!!nodes &&
|
||||||
nodes.map((nodeValue, index) => (
|
nodes.map((nodeValue, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={nodeValue}
|
||||||
className={styles.nodeStyle}
|
className={styles.nodeStyle}
|
||||||
data-active={value && value[0] >= nodeValue}
|
data-active={value && value[0] >= nodeValue}
|
||||||
data-disabled={disabled}
|
data-disabled={disabled}
|
||||||
|
|||||||
+1
@@ -75,6 +75,7 @@ export const ErrorDetail: FC<ErrorDetailProps> = props => {
|
|||||||
}, [onButtonClick, resetError]);
|
}, [onButtonClick, resetError]);
|
||||||
|
|
||||||
const desc = descriptions.map((item, i) => (
|
const desc = descriptions.map((item, i) => (
|
||||||
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
<p key={i} className={styles.text}>
|
<p key={i} className={styles.text}>
|
||||||
{item}
|
{item}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export const Slider = <T,>({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{items?.map((item, index) => (
|
{items?.map((item, index) => (
|
||||||
<div key={index} className={styles.slideItem}>
|
<div key={`${item}-${index}`} className={styles.slideItem}>
|
||||||
{preload === undefined || Math.abs(index - activeIndex) <= preload
|
{preload === undefined || Math.abs(index - activeIndex) <= preload
|
||||||
? itemRenderer?.(item, index)
|
? itemRenderer?.(item, index)
|
||||||
: null}
|
: null}
|
||||||
|
|||||||
@@ -210,6 +210,7 @@ export const EdgelessSwitch = ({
|
|||||||
{
|
{
|
||||||
/* render blocks */
|
/* render blocks */
|
||||||
article.blocks.map((block, key) => {
|
article.blocks.map((block, key) => {
|
||||||
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
return <OnboardingBlock key={key} mode={mode} {...block} />;
|
return <OnboardingBlock key={key} mode={mode} {...block} />;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -584,17 +584,17 @@ export function patchForMobile() {
|
|||||||
// Disable some toolbar widgets for mobile.
|
// Disable some toolbar widgets for mobile.
|
||||||
{
|
{
|
||||||
di.override(WidgetViewMapIdentifier('affine:page'), () => {
|
di.override(WidgetViewMapIdentifier('affine:page'), () => {
|
||||||
const ignoreWidgets = [
|
const ignoreWidgets = new Set([
|
||||||
AFFINE_FORMAT_BAR_WIDGET,
|
AFFINE_FORMAT_BAR_WIDGET,
|
||||||
AFFINE_EMBED_CARD_TOOLBAR_WIDGET,
|
AFFINE_EMBED_CARD_TOOLBAR_WIDGET,
|
||||||
];
|
]);
|
||||||
|
|
||||||
type pageRootWidgetViewMapKey = keyof typeof pageRootWidgetViewMap;
|
type pageRootWidgetViewMapKey = keyof typeof pageRootWidgetViewMap;
|
||||||
return (
|
return (
|
||||||
Object.keys(pageRootWidgetViewMap) as pageRootWidgetViewMapKey[]
|
Object.keys(pageRootWidgetViewMap) as pageRootWidgetViewMapKey[]
|
||||||
).reduce(
|
).reduce(
|
||||||
(acc, key) => {
|
(acc, key) => {
|
||||||
if (ignoreWidgets.includes(key)) return acc;
|
if (ignoreWidgets.has(key)) return acc;
|
||||||
acc[key] = pageRootWidgetViewMap[key];
|
acc[key] = pageRootWidgetViewMap[key];
|
||||||
return acc;
|
return acc;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ const IconsSelectorPanel = ({
|
|||||||
</div>
|
</div>
|
||||||
<Scrollable.Viewport className={styles.iconsContainerScrollable}>
|
<Scrollable.Viewport className={styles.iconsContainerScrollable}>
|
||||||
<div className={styles.iconsContainer}>
|
<div className={styles.iconsContainer}>
|
||||||
{iconRows.map((iconRow, index) => {
|
{iconRows.map(iconRow => {
|
||||||
return (
|
return (
|
||||||
<div key={index} className={styles.iconsRow}>
|
<div key={iconRow.join('-')} className={styles.iconsRow}>
|
||||||
{iconRow.map(iconName => {
|
{iconRow.map(iconName => {
|
||||||
const Icon = iconNameToComponent(iconName);
|
const Icon = iconNameToComponent(iconName);
|
||||||
return (
|
return (
|
||||||
|
|||||||
+2
-2
@@ -63,8 +63,8 @@ export const VirtualizedCollectionList = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const filteredSelectedCollectionIds = useMemo(() => {
|
const filteredSelectedCollectionIds = useMemo(() => {
|
||||||
const ids = collections.map(collection => collection.id);
|
const ids = new Set(collections.map(collection => collection.id));
|
||||||
return selectedCollectionIds.filter(id => ids.includes(id));
|
return selectedCollectionIds.filter(id => ids.has(id));
|
||||||
}, [collections, selectedCollectionIds]);
|
}, [collections, selectedCollectionIds]);
|
||||||
|
|
||||||
const hideFloatingToolbar = useCallback(() => {
|
const hideFloatingToolbar = useCallback(() => {
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ export const VirtualizedPageList = ({
|
|||||||
}, [filteredPageMetas, listItem]);
|
}, [filteredPageMetas, listItem]);
|
||||||
|
|
||||||
const filteredSelectedPageIds = useMemo(() => {
|
const filteredSelectedPageIds = useMemo(() => {
|
||||||
const ids = pageMetasToRender.map(page => page.id);
|
const ids = new Set(pageMetasToRender.map(page => page.id));
|
||||||
return selectedPageIds.filter(id => ids.includes(id));
|
return selectedPageIds.filter(id => ids.has(id));
|
||||||
}, [pageMetasToRender, selectedPageIds]);
|
}, [pageMetasToRender, selectedPageIds]);
|
||||||
|
|
||||||
const hideFloatingToolbar = useCallback(() => {
|
const hideFloatingToolbar = useCallback(() => {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ export const renderArgs = (
|
|||||||
const value = filter.args[i];
|
const value = filter.args[i];
|
||||||
return (
|
return (
|
||||||
<Arg
|
<Arg
|
||||||
key={i}
|
key={`${argType.type}-${i}`}
|
||||||
type={argType}
|
type={argType}
|
||||||
value={value}
|
value={value}
|
||||||
onChange={value => {
|
onChange={value => {
|
||||||
|
|||||||
@@ -136,12 +136,12 @@ const defaultSortingFn: SorterConfig<MetaRecord<ListItem>>['sortingFn'] = (
|
|||||||
return 0;
|
return 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
const validKeys: Array<keyof MetaRecord<ListItem>> = [
|
const validKeys: Set<keyof MetaRecord<ListItem>> = new Set([
|
||||||
'id',
|
'id',
|
||||||
'title',
|
'title',
|
||||||
'createDate',
|
'createDate',
|
||||||
'updatedDate',
|
'updatedDate',
|
||||||
];
|
]);
|
||||||
|
|
||||||
const sorterStateAtom = atom<SorterConfig<MetaRecord<ListItem>>>({
|
const sorterStateAtom = atom<SorterConfig<MetaRecord<ListItem>>>({
|
||||||
key: DEFAULT_SORT_KEY,
|
key: DEFAULT_SORT_KEY,
|
||||||
@@ -175,7 +175,7 @@ export const sorterAtom = atom(
|
|||||||
},
|
},
|
||||||
(_get, set, { newSortKey }: { newSortKey: keyof MetaRecord<ListItem> }) => {
|
(_get, set, { newSortKey }: { newSortKey: keyof MetaRecord<ListItem> }) => {
|
||||||
set(sorterStateAtom, sorterState => {
|
set(sorterStateAtom, sorterState => {
|
||||||
if (validKeys.includes(newSortKey)) {
|
if (validKeys.has(newSortKey)) {
|
||||||
return {
|
return {
|
||||||
...sorterState,
|
...sorterState,
|
||||||
key: newSortKey,
|
key: newSortKey,
|
||||||
|
|||||||
@@ -36,8 +36,8 @@ export const VirtualizedTagList = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const filteredSelectedTagIds = useMemo(() => {
|
const filteredSelectedTagIds = useMemo(() => {
|
||||||
const ids = tags.map(tag => tag.id);
|
const ids = new Set(tags.map(tag => tag.id));
|
||||||
return selectedTagIds.filter(id => ids.includes(id));
|
return selectedTagIds.filter(id => ids.has(id));
|
||||||
}, [selectedTagIds, tags]);
|
}, [selectedTagIds, tags]);
|
||||||
|
|
||||||
const hideFloatingToolbar = useCallback(() => {
|
const hideFloatingToolbar = useCallback(() => {
|
||||||
|
|||||||
@@ -33,8 +33,8 @@ export const VirtualizedTrashList = () => {
|
|||||||
const pageHeaderColsDef = usePageHeaderColsDef();
|
const pageHeaderColsDef = usePageHeaderColsDef();
|
||||||
|
|
||||||
const filteredSelectedPageIds = useMemo(() => {
|
const filteredSelectedPageIds = useMemo(() => {
|
||||||
const ids = filteredPageMetas.map(page => page.id);
|
const ids = new Set(filteredPageMetas.map(page => page.id));
|
||||||
return selectedPageIds.filter(id => ids.includes(id));
|
return selectedPageIds.filter(id => ids.has(id));
|
||||||
}, [filteredPageMetas, selectedPageIds]);
|
}, [filteredPageMetas, selectedPageIds]);
|
||||||
|
|
||||||
const hideFloatingToolbar = useCallback(() => {
|
const hideFloatingToolbar = useCallback(() => {
|
||||||
|
|||||||
@@ -87,12 +87,12 @@ const DesktopTagEditMenu = ({
|
|||||||
<MenuSeparator />
|
<MenuSeparator />
|
||||||
<Scrollable.Root>
|
<Scrollable.Root>
|
||||||
<Scrollable.Viewport className={styles.menuItemList}>
|
<Scrollable.Viewport className={styles.menuItemList}>
|
||||||
{colors.map(({ name, value: color }, i) => (
|
{colors.map(({ name, value: color }) => (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
key={i}
|
key={color}
|
||||||
checked={tag.color === color}
|
checked={tag.color === color}
|
||||||
prefixIcon={
|
prefixIcon={
|
||||||
<div key={i} className={styles.tagColorIconWrapper}>
|
<div className={styles.tagColorIconWrapper}>
|
||||||
<div
|
<div
|
||||||
className={styles.tagColorIcon}
|
className={styles.tagColorIcon}
|
||||||
style={{
|
style={{
|
||||||
@@ -173,14 +173,14 @@ const MobileTagEditMenu = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<ConfigModal.RowGroup title={t['Colors']()}>
|
<ConfigModal.RowGroup title={t['Colors']()}>
|
||||||
{colors.map(({ name, value: color }, i) => (
|
{colors.map(({ name, value: color }) => (
|
||||||
<ConfigModal.Row
|
<ConfigModal.Row
|
||||||
key={i}
|
key={color}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setLocalTag({ ...localTag, color });
|
setLocalTag({ ...localTag, color });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div key={i} className={styles.tagColorIconWrapper}>
|
<div className={styles.tagColorIconWrapper}>
|
||||||
<div
|
<div
|
||||||
className={styles.tagColorIcon}
|
className={styles.tagColorIcon}
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ export const LinksRow = ({
|
|||||||
title={`${label} · ${references.length}`}
|
title={`${label} · ${references.length}`}
|
||||||
className={className}
|
className={className}
|
||||||
>
|
>
|
||||||
{references.map((link, index) => (
|
{references.map(link => (
|
||||||
<AffinePageReference
|
<AffinePageReference
|
||||||
key={index}
|
key={link.docId}
|
||||||
pageId={link.docId}
|
pageId={link.docId}
|
||||||
params={'params' in link ? link.params : undefined}
|
params={'params' in link ? link.params : undefined}
|
||||||
className={styles.wrapper}
|
className={styles.wrapper}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ export const ExplorerTreeNode = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<MobileMenu
|
<MobileMenu
|
||||||
items={menuOperations.map(({ view }, index) => (
|
items={menuOperations.map(({ view, index }) => (
|
||||||
<Fragment key={index}>{view}</Fragment>
|
<Fragment key={index}>{view}</Fragment>
|
||||||
))}
|
))}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ export const RecentDocs = ({ max = 5 }: { max?: number }) => {
|
|||||||
>
|
>
|
||||||
<div className={styles.scroll} data-testid="recent-docs-list">
|
<div className={styles.scroll} data-testid="recent-docs-list">
|
||||||
<ul className={styles.list}>
|
<ul className={styles.list}>
|
||||||
{cardMetas.map((doc, index) => (
|
{cardMetas.map(doc => (
|
||||||
<li key={index} className={styles.cardWrapper}>
|
<li key={doc.id} className={styles.cardWrapper}>
|
||||||
<DocCard meta={doc} />
|
<DocCard meta={doc} />
|
||||||
</li>
|
</li>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -285,6 +285,7 @@ const RandomBars = ({ count, header }: { count: number; header?: boolean }) => {
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
{Array.from({ length: count }).map((_, index) => (
|
{Array.from({ length: count }).map((_, index) => (
|
||||||
|
// eslint-disable-next-line react/no-array-index-key
|
||||||
<RandomBar key={index} />
|
<RandomBar key={index} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import {
|
|||||||
} from '../services/app-tabs-header-service';
|
} from '../services/app-tabs-header-service';
|
||||||
import * as styles from './styles.css';
|
import * as styles from './styles.css';
|
||||||
|
|
||||||
const TabSupportType = ['collection', 'tag', 'doc'];
|
const TabSupportType = new Set(['collection', 'tag', 'doc']);
|
||||||
|
|
||||||
const tabCanDrop =
|
const tabCanDrop =
|
||||||
(tab?: TabStatus): NonNullable<DropTargetOptions<AffineDNDData>['canDrop']> =>
|
(tab?: TabStatus): NonNullable<DropTargetOptions<AffineDNDData>['canDrop']> =>
|
||||||
@@ -53,7 +53,7 @@ const tabCanDrop =
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
ctx.source.data.entity?.type &&
|
ctx.source.data.entity?.type &&
|
||||||
TabSupportType.includes(ctx.source.data.entity?.type)
|
TabSupportType.has(ctx.source.data.entity?.type)
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -383,12 +383,12 @@ export const ExplorerTreeNode = ({
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{inlineOperations.map(({ view }, index) => (
|
{inlineOperations.map(({ view, index }) => (
|
||||||
<Fragment key={index}>{view}</Fragment>
|
<Fragment key={index}>{view}</Fragment>
|
||||||
))}
|
))}
|
||||||
{menuOperations.length > 0 && (
|
{menuOperations.length > 0 && (
|
||||||
<Menu
|
<Menu
|
||||||
items={menuOperations.map(({ view }, index) => (
|
items={menuOperations.map(({ view, index }) => (
|
||||||
<Fragment key={index}>{view}</Fragment>
|
<Fragment key={index}>{view}</Fragment>
|
||||||
))}
|
))}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -314,9 +314,9 @@ const CMDKKeyBinding = ({ keyBinding }: { keyBinding: string }) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.keybinding}>
|
<div className={styles.keybinding}>
|
||||||
{fragments.map((fragment, index) => {
|
{fragments.map(fragment => {
|
||||||
return (
|
return (
|
||||||
<div key={index} className={styles.keybindingFragment}>
|
<div key={fragment} className={styles.keybindingFragment}>
|
||||||
{fragment}
|
{fragment}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ export const HighlightText = ({ text = '', end, start }: HighlightProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<span className={styles.highlightText}>
|
<span className={styles.highlightText}>
|
||||||
{parts.map((part, i) =>
|
{parts.map(part =>
|
||||||
typeof part === 'string' ? (
|
typeof part === 'string' ? (
|
||||||
<Fragment key={i}>{part}</Fragment>
|
<Fragment key={part}>{part}</Fragment>
|
||||||
) : (
|
) : (
|
||||||
<span key={i} className={styles.highlightKeyword}>
|
<span key={part.h} className={styles.highlightKeyword}>
|
||||||
{part.h}
|
{part.h}
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -690,7 +690,7 @@ __metadata:
|
|||||||
msw: "npm:^2.3.0"
|
msw: "npm:^2.3.0"
|
||||||
nx: "npm:^20.0.3"
|
nx: "npm:^20.0.3"
|
||||||
nx-cloud: "npm:^19.1.0"
|
nx-cloud: "npm:^19.1.0"
|
||||||
oxlint: "npm:0.12.0"
|
oxlint: "npm:0.13.2"
|
||||||
prettier: "npm:^3.3.3"
|
prettier: "npm:^3.3.3"
|
||||||
semver: "npm:^7.6.0"
|
semver: "npm:^7.6.0"
|
||||||
serve: "npm:^14.2.1"
|
serve: "npm:^14.2.1"
|
||||||
@@ -9495,58 +9495,58 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/darwin-arm64@npm:0.12.0":
|
"@oxlint/darwin-arm64@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/darwin-arm64@npm:0.12.0"
|
resolution: "@oxlint/darwin-arm64@npm:0.13.2"
|
||||||
conditions: os=darwin & cpu=arm64
|
conditions: os=darwin & cpu=arm64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/darwin-x64@npm:0.12.0":
|
"@oxlint/darwin-x64@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/darwin-x64@npm:0.12.0"
|
resolution: "@oxlint/darwin-x64@npm:0.13.2"
|
||||||
conditions: os=darwin & cpu=x64
|
conditions: os=darwin & cpu=x64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-arm64-gnu@npm:0.12.0":
|
"@oxlint/linux-arm64-gnu@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/linux-arm64-gnu@npm:0.12.0"
|
resolution: "@oxlint/linux-arm64-gnu@npm:0.13.2"
|
||||||
conditions: os=linux & cpu=arm64 & libc=glibc
|
conditions: os=linux & cpu=arm64 & libc=glibc
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-arm64-musl@npm:0.12.0":
|
"@oxlint/linux-arm64-musl@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/linux-arm64-musl@npm:0.12.0"
|
resolution: "@oxlint/linux-arm64-musl@npm:0.13.2"
|
||||||
conditions: os=linux & cpu=arm64 & libc=musl
|
conditions: os=linux & cpu=arm64 & libc=musl
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-x64-gnu@npm:0.12.0":
|
"@oxlint/linux-x64-gnu@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/linux-x64-gnu@npm:0.12.0"
|
resolution: "@oxlint/linux-x64-gnu@npm:0.13.2"
|
||||||
conditions: os=linux & cpu=x64 & libc=glibc
|
conditions: os=linux & cpu=x64 & libc=glibc
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/linux-x64-musl@npm:0.12.0":
|
"@oxlint/linux-x64-musl@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/linux-x64-musl@npm:0.12.0"
|
resolution: "@oxlint/linux-x64-musl@npm:0.13.2"
|
||||||
conditions: os=linux & cpu=x64 & libc=musl
|
conditions: os=linux & cpu=x64 & libc=musl
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/win32-arm64@npm:0.12.0":
|
"@oxlint/win32-arm64@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/win32-arm64@npm:0.12.0"
|
resolution: "@oxlint/win32-arm64@npm:0.13.2"
|
||||||
conditions: os=win32 & cpu=arm64
|
conditions: os=win32 & cpu=arm64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@oxlint/win32-x64@npm:0.12.0":
|
"@oxlint/win32-x64@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "@oxlint/win32-x64@npm:0.12.0"
|
resolution: "@oxlint/win32-x64@npm:0.13.2"
|
||||||
conditions: os=win32 & cpu=x64
|
conditions: os=win32 & cpu=x64
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
@@ -26744,18 +26744,18 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"oxlint@npm:0.12.0":
|
"oxlint@npm:0.13.2":
|
||||||
version: 0.12.0
|
version: 0.13.2
|
||||||
resolution: "oxlint@npm:0.12.0"
|
resolution: "oxlint@npm:0.13.2"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@oxlint/darwin-arm64": "npm:0.12.0"
|
"@oxlint/darwin-arm64": "npm:0.13.2"
|
||||||
"@oxlint/darwin-x64": "npm:0.12.0"
|
"@oxlint/darwin-x64": "npm:0.13.2"
|
||||||
"@oxlint/linux-arm64-gnu": "npm:0.12.0"
|
"@oxlint/linux-arm64-gnu": "npm:0.13.2"
|
||||||
"@oxlint/linux-arm64-musl": "npm:0.12.0"
|
"@oxlint/linux-arm64-musl": "npm:0.13.2"
|
||||||
"@oxlint/linux-x64-gnu": "npm:0.12.0"
|
"@oxlint/linux-x64-gnu": "npm:0.13.2"
|
||||||
"@oxlint/linux-x64-musl": "npm:0.12.0"
|
"@oxlint/linux-x64-musl": "npm:0.13.2"
|
||||||
"@oxlint/win32-arm64": "npm:0.12.0"
|
"@oxlint/win32-arm64": "npm:0.13.2"
|
||||||
"@oxlint/win32-x64": "npm:0.12.0"
|
"@oxlint/win32-x64": "npm:0.13.2"
|
||||||
dependenciesMeta:
|
dependenciesMeta:
|
||||||
"@oxlint/darwin-arm64":
|
"@oxlint/darwin-arm64":
|
||||||
optional: true
|
optional: true
|
||||||
@@ -26776,7 +26776,7 @@ __metadata:
|
|||||||
bin:
|
bin:
|
||||||
oxc_language_server: bin/oxc_language_server
|
oxc_language_server: bin/oxc_language_server
|
||||||
oxlint: bin/oxlint
|
oxlint: bin/oxlint
|
||||||
checksum: 10/5bff1a038776017ded1c4367b87d23e5a4b03ce26ad9d6968d21c77bc054d0a02c24fd6c85f58f8688181f08729a5d1900b50966bf560c50093e015cecc24a81
|
checksum: 10/6dd341961c4c1e1de7e2f3d16d0998f42961694497717c00047041611d023ae6b8c7f32b4431f1e7c37ed4fcf4e300cdb25a1bd46b55baeec4cda1b0479e6a2a
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user