style: enable import-x/no-duplicates (#6279)

This commit is contained in:
EYHN
2024-03-25 03:55:32 +00:00
parent 7ce2bfbf0b
commit f2adbdaba4
342 changed files with 881 additions and 1033 deletions

View File

@@ -1,6 +1,11 @@
import { nanoid } from 'nanoid';
import { Array as YArray, Doc as YDoc, Map as YMap } from 'yjs';
import { applyUpdate, encodeStateAsUpdate } from 'yjs';
import {
applyUpdate,
Array as YArray,
Doc as YDoc,
encodeStateAsUpdate,
Map as YMap,
} from 'yjs';
const migrationOrigin = 'affine-migration';

View File

@@ -2,11 +2,8 @@ import { DebugLogger } from '@affine/debug';
// @ts-expect-error upstream type is wrong
import { tinykeys } from 'tinykeys';
import {
type AffineCommand,
type AffineCommandOptions,
createAffineCommand,
} from './command';
import type { AffineCommand, AffineCommandOptions } from './command';
import { createAffineCommand } from './command';
const commandLogger = new DebugLogger('command:registry');

View File

@@ -6,10 +6,10 @@ import {
ServiceNotFoundError,
} from './error';
import { parseIdentifier } from './identifier';
import {
type GeneralServiceIdentifier,
type ServiceIdentifierValue,
type ServiceVariant,
import type {
GeneralServiceIdentifier,
ServiceIdentifierValue,
ServiceVariant,
} from './types';
export interface ResolveOptions {

View File

@@ -1,7 +1,7 @@
import React, { useContext } from 'react';
import type { ServiceProvider } from '../core';
import { type GeneralServiceIdentifier, ServiceCollection } from '../core';
import type { GeneralServiceIdentifier, ServiceProvider } from '../core';
import { ServiceCollection } from '../core';
export const ServiceProviderContext = React.createContext(
ServiceCollection.EMPTY.provider()

View File

@@ -1,22 +1,25 @@
import { DebugLogger } from '@affine/debug';
import type {
InteropObservable,
Observer,
OperatorFunction,
Subscription,
TeardownLogic,
} from 'rxjs';
import {
BehaviorSubject,
combineLatest,
distinctUntilChanged,
EMPTY,
filter,
type InteropObservable,
map,
Observable,
type Observer,
of,
type OperatorFunction,
scan,
skip,
type Subscription,
Subject,
switchMap,
type TeardownLogic,
} from 'rxjs';
import { BehaviorSubject, Subject } from 'rxjs';
export * from './react';

View File

@@ -1,6 +1,7 @@
import type { Doc as BlockSuiteDoc } from '@blocksuite/store';
import { createIdentifier, type ServiceCollection } from '../di';
import type { ServiceCollection } from '../di';
import { createIdentifier } from '../di';
import type { PageRecord } from './record';
import { PageScope } from './service-scope';

View File

@@ -4,7 +4,8 @@ export * from './record';
export * from './record-list';
export * from './service-scope';
import { type ServiceCollection, ServiceProvider } from '../di';
import type { ServiceCollection } from '../di';
import { ServiceProvider } from '../di';
import { CleanupService } from '../lifecycle';
import { Workspace, WorkspaceLocalState, WorkspaceScope } from '../workspace';
import { BlockSuitePageContext, PageRecordContext } from './context';

View File

@@ -2,7 +2,7 @@ import { isEqual } from 'lodash-es';
import { distinctUntilChanged, map, Observable } from 'rxjs';
import { LiveData } from '../livedata';
import { type Workspace, type WorkspaceLocalState } from '../workspace';
import type { Workspace, WorkspaceLocalState } from '../workspace';
import { PageRecord } from './record';
export class PageRecordList {

View File

@@ -1,4 +1,5 @@
import { createScope, type ServiceScope } from '../di';
import type { ServiceScope } from '../di';
import { createScope } from '../di';
import { WorkspaceScope } from '../workspace';
export const PageScope: ServiceScope = createScope('page', WorkspaceScope);

View File

@@ -23,7 +23,8 @@ import { nanoid } from 'nanoid';
import type { Awareness } from 'y-protocols/awareness.js';
import type { Doc as YDoc } from 'yjs';
import { createIdentifier, type ServiceCollection } from '../di';
import type { ServiceCollection } from '../di';
import { createIdentifier } from '../di';
import { BlobEngine } from './engine/blob';
import { globalBlockSuiteSchema } from './global-schema';
import type { WorkspaceMetadata } from './metadata';

View File

@@ -1,7 +1,12 @@
import { nanoid } from 'nanoid';
import { describe, expect, test, vitest } from 'vitest';
import { Doc as YDoc, encodeStateAsUpdate } from 'yjs';
import { diffUpdate, encodeStateVectorFromUpdate, mergeUpdates } from 'yjs';
import {
diffUpdate,
Doc as YDoc,
encodeStateAsUpdate,
encodeStateVectorFromUpdate,
mergeUpdates,
} from 'yjs';
import { AsyncLock } from '../../../../utils';
import { DocEngine } from '..';

View File

@@ -9,7 +9,8 @@ import { MANUALLY_STOP } from '../../../utils';
import { DocEngineLocalPart } from './local';
import { DocEngineRemotePart } from './remote';
import type { DocServer } from './server';
import { type DocStorage, DocStorageInner } from './storage';
import type { DocStorage } from './storage';
import { DocStorageInner } from './storage';
const logger = new DebugLogger('doc-engine');

View File

@@ -1,10 +1,5 @@
import {
type ByteKV,
type Memento,
MemoryMemento,
ReadonlyByteKV,
wrapMemento,
} from '../../../storage';
import type { ByteKV, Memento } from '../../../storage';
import { MemoryMemento, ReadonlyByteKV, wrapMemento } from '../../../storage';
import { AsyncLock, mergeUpdates, throwIfAborted } from '../../../utils';
import type { DocEventBus } from '.';
import { DocEventBusInner, MemoryDocEventBus } from './event';

View File

@@ -1,4 +1,5 @@
import { createIdentifier, type ServiceCollection } from '../di';
import type { ServiceCollection } from '../di';
import { createIdentifier } from '../di';
export interface WorkspaceFactory {
name: string;

View File

@@ -11,7 +11,8 @@ export * from './testing';
export * from './upgrade';
export * from './workspace';
import { type ServiceCollection, ServiceProvider } from '../di';
import type { ServiceCollection } from '../di';
import { ServiceProvider } from '../di';
import { CleanupService } from '../lifecycle';
import { GlobalCache, GlobalState, MemoryMemento } from '../storage';
import {

View File

@@ -1,5 +1,5 @@
import type { GlobalCache } from '../../storage';
import { type WorkspaceMetadata } from '../metadata';
import type { WorkspaceMetadata } from '../metadata';
const CACHE_STORAGE_KEY = 'jotai-workspaces';

View File

@@ -9,7 +9,8 @@ import type { GlobalCache } from '../../storage';
import type { BlobStorage } from '../engine';
import type { WorkspaceMetadata } from '../metadata';
import { readWorkspaceListCache, writeWorkspaceListCache } from './cache';
import { type WorkspaceInfo, WorkspaceInformation } from './information';
import type { WorkspaceInfo } from './information';
import { WorkspaceInformation } from './information';
export * from './information';

View File

@@ -4,12 +4,13 @@ import { differenceBy } from 'lodash-es';
import { nanoid } from 'nanoid';
import { applyUpdate, encodeStateAsUpdate } from 'yjs';
import { type ServiceCollection } from '../di';
import { GlobalState, type Memento } from '../storage';
import type { ServiceCollection } from '../di';
import type { Memento } from '../storage';
import { GlobalState } from '../storage';
import { WorkspaceMetadataContext } from './context';
import type { BlobStorage } from './engine';
import {
AwarenessProvider,
type BlobStorage,
DocStorageImpl,
LocalBlobStorage,
MemoryDocStorage,
@@ -17,9 +18,8 @@ import {
import { MemoryStorage } from './engine/doc/storage';
import type { WorkspaceFactory } from './factory';
import { globalBlockSuiteSchema } from './global-schema';
import type { WorkspaceListProvider } from './list';
import { type WorkspaceInfo } from './list';
import { type WorkspaceMetadata } from './metadata';
import type { WorkspaceInfo, WorkspaceListProvider } from './list';
import type { WorkspaceMetadata } from './metadata';
import { WorkspaceScope } from './service-scope';
const LIST_STORE_KEY = 'testing-workspace-list';

View File

@@ -4,12 +4,16 @@ import { Slot } from '@blocksuite/global/utils';
import type { DocCollection } from '@blocksuite/store';
import { applyUpdate, Doc as YDoc, encodeStateAsUpdate } from 'yjs';
import { checkWorkspaceCompatibility, MigrationPoint } from '../blocksuite';
import { forceUpgradePages, upgradeV1ToV2 } from '../blocksuite';
import { migrateGuidCompatibility } from '../blocksuite';
import {
checkWorkspaceCompatibility,
forceUpgradePages,
migrateGuidCompatibility,
MigrationPoint,
upgradeV1ToV2,
} from '../blocksuite';
import type { DocEngine } from './engine';
import type { WorkspaceManager } from './manager';
import { type WorkspaceMetadata } from './metadata';
import type { WorkspaceMetadata } from './metadata';
export interface WorkspaceUpgradeStatus {
needUpgrade: boolean;

View File

@@ -4,11 +4,12 @@ import type { DocCollection } from '@blocksuite/store';
import type { ServiceProvider } from '../di';
import { CleanupService } from '../lifecycle';
import type { WorkspaceEngine } from './engine';
import { type WorkspaceEngineStatus } from './engine';
import { type WorkspaceMetadata } from './metadata';
import type { WorkspaceUpgradeController } from './upgrade';
import { type WorkspaceUpgradeStatus } from './upgrade';
import type { WorkspaceEngine, WorkspaceEngineStatus } from './engine';
import type { WorkspaceMetadata } from './metadata';
import type {
WorkspaceUpgradeController,
WorkspaceUpgradeStatus,
} from './upgrade';
export type { DocCollection } from '@blocksuite/store';