mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
chore: upgrade oxlint to v0.13.2 (#8891)
Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
@@ -75,6 +75,7 @@ export const ErrorDetail: FC<ErrorDetailProps> = props => {
|
||||
}, [onButtonClick, resetError]);
|
||||
|
||||
const desc = descriptions.map((item, i) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<p key={i} className={styles.text}>
|
||||
{item}
|
||||
</p>
|
||||
|
||||
@@ -46,7 +46,7 @@ export const Slider = <T,>({
|
||||
}}
|
||||
>
|
||||
{items?.map((item, index) => (
|
||||
<div key={index} className={styles.slideItem}>
|
||||
<div key={`${item}-${index}`} className={styles.slideItem}>
|
||||
{preload === undefined || Math.abs(index - activeIndex) <= preload
|
||||
? itemRenderer?.(item, index)
|
||||
: null}
|
||||
|
||||
@@ -210,6 +210,7 @@ export const EdgelessSwitch = ({
|
||||
{
|
||||
/* render blocks */
|
||||
article.blocks.map((block, key) => {
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
return <OnboardingBlock key={key} mode={mode} {...block} />;
|
||||
})
|
||||
}
|
||||
|
||||
@@ -584,17 +584,17 @@ export function patchForMobile() {
|
||||
// Disable some toolbar widgets for mobile.
|
||||
{
|
||||
di.override(WidgetViewMapIdentifier('affine:page'), () => {
|
||||
const ignoreWidgets = [
|
||||
const ignoreWidgets = new Set([
|
||||
AFFINE_FORMAT_BAR_WIDGET,
|
||||
AFFINE_EMBED_CARD_TOOLBAR_WIDGET,
|
||||
];
|
||||
]);
|
||||
|
||||
type pageRootWidgetViewMapKey = keyof typeof pageRootWidgetViewMap;
|
||||
return (
|
||||
Object.keys(pageRootWidgetViewMap) as pageRootWidgetViewMapKey[]
|
||||
).reduce(
|
||||
(acc, key) => {
|
||||
if (ignoreWidgets.includes(key)) return acc;
|
||||
if (ignoreWidgets.has(key)) return acc;
|
||||
acc[key] = pageRootWidgetViewMap[key];
|
||||
return acc;
|
||||
},
|
||||
|
||||
@@ -26,9 +26,9 @@ const IconsSelectorPanel = ({
|
||||
</div>
|
||||
<Scrollable.Viewport className={styles.iconsContainerScrollable}>
|
||||
<div className={styles.iconsContainer}>
|
||||
{iconRows.map((iconRow, index) => {
|
||||
{iconRows.map(iconRow => {
|
||||
return (
|
||||
<div key={index} className={styles.iconsRow}>
|
||||
<div key={iconRow.join('-')} className={styles.iconsRow}>
|
||||
{iconRow.map(iconName => {
|
||||
const Icon = iconNameToComponent(iconName);
|
||||
return (
|
||||
|
||||
@@ -63,8 +63,8 @@ export const VirtualizedCollectionList = ({
|
||||
});
|
||||
|
||||
const filteredSelectedCollectionIds = useMemo(() => {
|
||||
const ids = collections.map(collection => collection.id);
|
||||
return selectedCollectionIds.filter(id => ids.includes(id));
|
||||
const ids = new Set(collections.map(collection => collection.id));
|
||||
return selectedCollectionIds.filter(id => ids.has(id));
|
||||
}, [collections, selectedCollectionIds]);
|
||||
|
||||
const hideFloatingToolbar = useCallback(() => {
|
||||
|
||||
@@ -83,8 +83,8 @@ export const VirtualizedPageList = ({
|
||||
}, [filteredPageMetas, listItem]);
|
||||
|
||||
const filteredSelectedPageIds = useMemo(() => {
|
||||
const ids = pageMetasToRender.map(page => page.id);
|
||||
return selectedPageIds.filter(id => ids.includes(id));
|
||||
const ids = new Set(pageMetasToRender.map(page => page.id));
|
||||
return selectedPageIds.filter(id => ids.has(id));
|
||||
}, [pageMetasToRender, selectedPageIds]);
|
||||
|
||||
const hideFloatingToolbar = useCallback(() => {
|
||||
|
||||
@@ -163,7 +163,7 @@ export const renderArgs = (
|
||||
const value = filter.args[i];
|
||||
return (
|
||||
<Arg
|
||||
key={i}
|
||||
key={`${argType.type}-${i}`}
|
||||
type={argType}
|
||||
value={value}
|
||||
onChange={value => {
|
||||
|
||||
@@ -136,12 +136,12 @@ const defaultSortingFn: SorterConfig<MetaRecord<ListItem>>['sortingFn'] = (
|
||||
return 0;
|
||||
};
|
||||
|
||||
const validKeys: Array<keyof MetaRecord<ListItem>> = [
|
||||
const validKeys: Set<keyof MetaRecord<ListItem>> = new Set([
|
||||
'id',
|
||||
'title',
|
||||
'createDate',
|
||||
'updatedDate',
|
||||
];
|
||||
]);
|
||||
|
||||
const sorterStateAtom = atom<SorterConfig<MetaRecord<ListItem>>>({
|
||||
key: DEFAULT_SORT_KEY,
|
||||
@@ -175,7 +175,7 @@ export const sorterAtom = atom(
|
||||
},
|
||||
(_get, set, { newSortKey }: { newSortKey: keyof MetaRecord<ListItem> }) => {
|
||||
set(sorterStateAtom, sorterState => {
|
||||
if (validKeys.includes(newSortKey)) {
|
||||
if (validKeys.has(newSortKey)) {
|
||||
return {
|
||||
...sorterState,
|
||||
key: newSortKey,
|
||||
|
||||
@@ -36,8 +36,8 @@ export const VirtualizedTagList = ({
|
||||
);
|
||||
|
||||
const filteredSelectedTagIds = useMemo(() => {
|
||||
const ids = tags.map(tag => tag.id);
|
||||
return selectedTagIds.filter(id => ids.includes(id));
|
||||
const ids = new Set(tags.map(tag => tag.id));
|
||||
return selectedTagIds.filter(id => ids.has(id));
|
||||
}, [selectedTagIds, tags]);
|
||||
|
||||
const hideFloatingToolbar = useCallback(() => {
|
||||
|
||||
@@ -33,8 +33,8 @@ export const VirtualizedTrashList = () => {
|
||||
const pageHeaderColsDef = usePageHeaderColsDef();
|
||||
|
||||
const filteredSelectedPageIds = useMemo(() => {
|
||||
const ids = filteredPageMetas.map(page => page.id);
|
||||
return selectedPageIds.filter(id => ids.includes(id));
|
||||
const ids = new Set(filteredPageMetas.map(page => page.id));
|
||||
return selectedPageIds.filter(id => ids.has(id));
|
||||
}, [filteredPageMetas, selectedPageIds]);
|
||||
|
||||
const hideFloatingToolbar = useCallback(() => {
|
||||
|
||||
@@ -87,12 +87,12 @@ const DesktopTagEditMenu = ({
|
||||
<MenuSeparator />
|
||||
<Scrollable.Root>
|
||||
<Scrollable.Viewport className={styles.menuItemList}>
|
||||
{colors.map(({ name, value: color }, i) => (
|
||||
{colors.map(({ name, value: color }) => (
|
||||
<MenuItem
|
||||
key={i}
|
||||
key={color}
|
||||
checked={tag.color === color}
|
||||
prefixIcon={
|
||||
<div key={i} className={styles.tagColorIconWrapper}>
|
||||
<div className={styles.tagColorIconWrapper}>
|
||||
<div
|
||||
className={styles.tagColorIcon}
|
||||
style={{
|
||||
@@ -173,14 +173,14 @@ const MobileTagEditMenu = ({
|
||||
/>
|
||||
|
||||
<ConfigModal.RowGroup title={t['Colors']()}>
|
||||
{colors.map(({ name, value: color }, i) => (
|
||||
{colors.map(({ name, value: color }) => (
|
||||
<ConfigModal.Row
|
||||
key={i}
|
||||
key={color}
|
||||
onClick={() => {
|
||||
setLocalTag({ ...localTag, color });
|
||||
}}
|
||||
>
|
||||
<div key={i} className={styles.tagColorIconWrapper}>
|
||||
<div className={styles.tagColorIconWrapper}>
|
||||
<div
|
||||
className={styles.tagColorIcon}
|
||||
style={{
|
||||
|
||||
@@ -21,9 +21,9 @@ export const LinksRow = ({
|
||||
title={`${label} · ${references.length}`}
|
||||
className={className}
|
||||
>
|
||||
{references.map((link, index) => (
|
||||
{references.map(link => (
|
||||
<AffinePageReference
|
||||
key={index}
|
||||
key={link.docId}
|
||||
pageId={link.docId}
|
||||
params={'params' in link ? link.params : undefined}
|
||||
className={styles.wrapper}
|
||||
|
||||
@@ -116,7 +116,7 @@ export const ExplorerTreeNode = ({
|
||||
}}
|
||||
>
|
||||
<MobileMenu
|
||||
items={menuOperations.map(({ view }, index) => (
|
||||
items={menuOperations.map(({ view, index }) => (
|
||||
<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">
|
||||
<ul className={styles.list}>
|
||||
{cardMetas.map((doc, index) => (
|
||||
<li key={index} className={styles.cardWrapper}>
|
||||
{cardMetas.map(doc => (
|
||||
<li key={doc.id} className={styles.cardWrapper}>
|
||||
<DocCard meta={doc} />
|
||||
</li>
|
||||
))}
|
||||
|
||||
@@ -285,6 +285,7 @@ const RandomBars = ({ count, header }: { count: number; header?: boolean }) => {
|
||||
/>
|
||||
) : null}
|
||||
{Array.from({ length: count }).map((_, index) => (
|
||||
// eslint-disable-next-line react/no-array-index-key
|
||||
<RandomBar key={index} />
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -39,7 +39,7 @@ import {
|
||||
} from '../services/app-tabs-header-service';
|
||||
import * as styles from './styles.css';
|
||||
|
||||
const TabSupportType = ['collection', 'tag', 'doc'];
|
||||
const TabSupportType = new Set(['collection', 'tag', 'doc']);
|
||||
|
||||
const tabCanDrop =
|
||||
(tab?: TabStatus): NonNullable<DropTargetOptions<AffineDNDData>['canDrop']> =>
|
||||
@@ -53,7 +53,7 @@ const tabCanDrop =
|
||||
|
||||
if (
|
||||
ctx.source.data.entity?.type &&
|
||||
TabSupportType.includes(ctx.source.data.entity?.type)
|
||||
TabSupportType.has(ctx.source.data.entity?.type)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -383,12 +383,12 @@ export const ExplorerTreeNode = ({
|
||||
e.preventDefault();
|
||||
}}
|
||||
>
|
||||
{inlineOperations.map(({ view }, index) => (
|
||||
{inlineOperations.map(({ view, index }) => (
|
||||
<Fragment key={index}>{view}</Fragment>
|
||||
))}
|
||||
{menuOperations.length > 0 && (
|
||||
<Menu
|
||||
items={menuOperations.map(({ view }, index) => (
|
||||
items={menuOperations.map(({ view, index }) => (
|
||||
<Fragment key={index}>{view}</Fragment>
|
||||
))}
|
||||
>
|
||||
|
||||
@@ -314,9 +314,9 @@ const CMDKKeyBinding = ({ keyBinding }: { keyBinding: string }) => {
|
||||
|
||||
return (
|
||||
<div className={styles.keybinding}>
|
||||
{fragments.map((fragment, index) => {
|
||||
{fragments.map(fragment => {
|
||||
return (
|
||||
<div key={index} className={styles.keybindingFragment}>
|
||||
<div key={fragment} className={styles.keybindingFragment}>
|
||||
{fragment}
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -30,11 +30,11 @@ export const HighlightText = ({ text = '', end, start }: HighlightProps) => {
|
||||
|
||||
return (
|
||||
<span className={styles.highlightText}>
|
||||
{parts.map((part, i) =>
|
||||
{parts.map(part =>
|
||||
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}
|
||||
</span>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user