Преглед изворни кода

fix eslint errors for import lines

Yuki Takei пре 1 година
родитељ
комит
f0926adebf

+ 4 - 2
apps/app/src/client/components/AuthorInfo/AuthorInfo.tsx

@@ -1,7 +1,9 @@
 import React from 'react';
 
-import type { IUserHasId } from '@growi/core';
-import { isPopulated, type IUser, type Ref } from '@growi/core';
+import {
+  isPopulated,
+  type IUser, type Ref, type IUserHasId,
+} from '@growi/core';
 import { pagePathUtils } from '@growi/core/dist/utils';
 import { UserPicture } from '@growi/ui/dist/components';
 import { format } from 'date-fns/format';

+ 1 - 2
apps/app/src/client/components/Sidebar/PageTreeItem/PageTreeItem.tsx

@@ -17,9 +17,8 @@ import type { IPageForItem } from '~/interfaces/page';
 import { mutatePageTree, useSWRxPageChildren } from '~/stores/page-listing';
 import loggerFactory from '~/utils/logger';
 
-import type { ItemNode } from '../../TreeItem';
 import {
-  TreeItemLayout, useNewPageInput, type TreeItemProps,
+  TreeItemLayout, useNewPageInput, type TreeItemProps, type ItemNode,
 } from '../../TreeItem';
 
 import { CountBadgeForPageTreeItem } from './CountBadgeForPageTreeItem';

+ 1 - 2
apps/app/src/client/components/TreeItem/NewPageInput/use-new-page-input.tsx

@@ -1,6 +1,5 @@
-import type { ChangeEvent } from 'react';
 import React, {
-  useState, type FC, useCallback, useRef,
+  useState, type FC, useCallback, useRef, type ChangeEvent,
 } from 'react';
 
 import nodePath from 'path';

+ 3 - 2
apps/app/src/components/User/Username.tsx

@@ -1,7 +1,8 @@
 import React from 'react';
 
-import type { IUserHasId } from '@growi/core';
-import { isPopulated, type IUser, type Ref } from '@growi/core';
+import {
+  isPopulated, type IUser, type Ref, type IUserHasId,
+} from '@growi/core';
 import { pagePathUtils } from '@growi/core/dist/utils';
 import Link from 'next/link';
 

+ 4 - 5
apps/app/src/features/openai/server/models/vector-store-file-relation.ts

@@ -1,12 +1,11 @@
-import type { Types } from 'mongoose';
-import type mongoose from 'mongoose';
-import { type Model, type Document, Schema } from 'mongoose';
+import { Schema } from 'mongoose';
+import type { Types, Model, Document } from 'mongoose';
 
 import { getOrCreateModel } from '~/server/util/mongoose-utils';
 
 export interface VectorStoreFileRelation {
-  vectorStoreRelationId: mongoose.Types.ObjectId;
-  page: mongoose.Types.ObjectId;
+  vectorStoreRelationId: Types.ObjectId;
+  page: Types.ObjectId;
   fileIds: string[];
   isAttachedToVectorStore: boolean;
 }

+ 5 - 4
apps/app/src/features/questionnaire/server/util/condition.ts

@@ -1,7 +1,8 @@
-import { ICondition } from '../../interfaces/condition';
-import { IGrowiInfo } from '../../interfaces/growi-info';
-import { IQuestionnaireOrder } from '../../interfaces/questionnaire-order';
-import { IUserInfo, UserType } from '../../interfaces/user-info';
+import type { ICondition } from '../../interfaces/condition';
+import type { IGrowiInfo } from '../../interfaces/growi-info';
+import type { IQuestionnaireOrder } from '../../interfaces/questionnaire-order';
+import type { IUserInfo } from '../../interfaces/user-info';
+import { UserType } from '../../interfaces/user-info';
 
 
 const checkUserInfo = (condition: ICondition, userInfo: IUserInfo): boolean => {

+ 3 - 2
apps/app/src/server/models/external-account.ts

@@ -1,7 +1,8 @@
 // disable no-return-await for model functions
 /* eslint-disable no-return-await */
-import type { IUser } from '@growi/core/dist/interfaces';
-import { type IExternalAccount, type IExternalAccountHasId, type IUserHasId } from '@growi/core/dist/interfaces';
+import {
+  type IExternalAccount, type IExternalAccountHasId, type IUser, type IUserHasId,
+} from '@growi/core/dist/interfaces';
 import type { Model, Document, HydratedDocument } from 'mongoose';
 import mongoose, { Schema } from 'mongoose';
 import mongoosePaginate from 'mongoose-paginate-v2';

+ 1 - 2
apps/app/src/server/models/revision.ts

@@ -4,9 +4,8 @@ import type {
   IRevision,
   Origin,
 } from '@growi/core/dist/interfaces';
-import type { Types } from 'mongoose';
 import {
-  Schema, type Document, type Model,
+  Schema, type Types, type Document, type Model,
 } from 'mongoose';
 import mongoosePaginate from 'mongoose-paginate-v2';
 

+ 4 - 6
apps/app/src/server/service/file-uploader/azure.ts

@@ -2,20 +2,18 @@ import type { ReadStream } from 'fs';
 
 import type { TokenCredential } from '@azure/identity';
 import { ClientSecretCredential } from '@azure/identity';
-import type {
-  BlobClient,
-  BlockBlobClient,
-  BlobDeleteOptions,
-  ContainerClient,
-} from '@azure/storage-blob';
 import {
   generateBlobSASQueryParameters,
   BlobServiceClient,
   ContainerSASPermissions,
   SASProtocol,
+  type BlobClient,
+  type BlockBlobClient,
+  type BlobDeleteOptions,
   type BlobDeleteIfExistsResponse,
   type BlockBlobUploadResponse,
   type BlockBlobParallelUploadOptions,
+  type ContainerClient,
 } from '@azure/storage-blob';
 
 import { ResponseMode, type RespondOptions } from '~/server/interfaces/attachment';

+ 1 - 2
apps/app/src/server/service/import/overwrite-function.ts

@@ -1,8 +1,7 @@
 import { parseISO } from 'date-fns/parseISO';
 import isIsoDate from 'is-iso-date';
-import type { Schema } from 'mongoose';
 import {
-  Types, type Document,
+  Types, type Document, type Schema,
 } from 'mongoose';
 
 

+ 1 - 2
apps/app/src/server/service/normalize-data/convert-revision-page-id-to-objectid.ts

@@ -4,8 +4,7 @@ import { type IRevisionHasId } from '@growi/core';
 import type { FilterQuery, UpdateQuery } from 'mongoose';
 import mongoose from 'mongoose';
 
-import type { IRevisionDocument } from '~/server/models/revision';
-import { type IRevisionModel } from '~/server/models/revision';
+import type { IRevisionDocument, IRevisionModel } from '~/server/models/revision';
 import loggerFactory from '~/utils/logger';
 
 const logger = loggerFactory('growi:service:NormalizeData:convert-revision-page-id-to-string');

+ 2 - 4
apps/app/src/server/service/page-grant.ts

@@ -1,6 +1,5 @@
-import type { IPage } from '@growi/core';
 import {
-  type IGrantedGroup,
+  type IGrantedGroup, type IPage,
   PageGrant, GroupType, getIdForRef,
 } from '@growi/core';
 import {
@@ -12,8 +11,7 @@ import mongoose from 'mongoose';
 import type { ExternalGroupProviderType } from '~/features/external-user-group/interfaces/external-user-group';
 import ExternalUserGroup from '~/features/external-user-group/server/models/external-user-group';
 import ExternalUserGroupRelation from '~/features/external-user-group/server/models/external-user-group-relation';
-import type { UserRelatedGroupsData } from '~/interfaces/page';
-import { UserGroupPageGrantStatus, type GroupGrantData } from '~/interfaces/page';
+import { UserGroupPageGrantStatus, type UserRelatedGroupsData, type GroupGrantData } from '~/interfaces/page';
 import type { IRecordApplicableGrant, PopulatedGrantedGroup } from '~/interfaces/page-grant';
 import type { PageDocument, PageModel } from '~/server/models/page';
 import UserGroup from '~/server/models/user-group';

+ 1 - 2
apps/app/src/server/service/page/index.ts

@@ -38,9 +38,8 @@ import {
 import { PageActionOnGroupDelete } from '~/interfaces/user-group';
 import { SocketEventName, type PageMigrationErrorData, type UpdateDescCountRawData } from '~/interfaces/websocket';
 import type { CurrentPageYjsData } from '~/interfaces/yjs';
-import type { CreateMethod } from '~/server/models/page';
 import {
-  type PageModel, type PageDocument, pushRevision, PageQueryBuilder,
+  type PageModel, type PageDocument, type CreateMethod, pushRevision, PageQueryBuilder,
 } from '~/server/models/page';
 import type { PageTagRelationDocument } from '~/server/models/page-tag-relation';
 import PageTagRelation from '~/server/models/page-tag-relation';

+ 3 - 4
apps/app/src/server/service/yjs/yjs.ts

@@ -5,8 +5,7 @@ import type { IPage, IUserHasId } from '@growi/core';
 import { YDocStatus } from '@growi/core/dist/consts';
 import mongoose from 'mongoose';
 import type { Server } from 'socket.io';
-import type { Document } from 'y-socket.io/dist/server';
-import { YSocketIO, type Document as Ydoc } from 'y-socket.io/dist/server';
+import { YSocketIO, type Document } from 'y-socket.io/dist/server';
 
 import { SocketEventName } from '~/interfaces/websocket';
 import type { SyncLatestRevisionBody } from '~/interfaces/yjs';
@@ -36,7 +35,7 @@ type RequestWithUser = IncomingMessage & { user: IUserHasId };
 export interface IYjsService {
   getYDocStatus(pageId: string): Promise<YDocStatus>;
   syncWithTheLatestRevisionForce(pageId: string, editingMarkdownLength?: number): Promise<SyncLatestRevisionBody>
-  getCurrentYdoc(pageId: string): Ydoc | undefined;
+  getCurrentYdoc(pageId: string): Document | undefined;
 }
 
 
@@ -204,7 +203,7 @@ class YjsService implements IYjsService {
     };
   }
 
-  public getCurrentYdoc(pageId: string): Ydoc | undefined {
+  public getCurrentYdoc(pageId: string): Document | undefined {
     const currentYdoc = this.ysocketio.documents.get(pageId);
     return currentYdoc;
   }

+ 4 - 5
apps/app/src/stores/ui.tsx

@@ -10,9 +10,8 @@ import { Breakpoint } from '@growi/ui/dist/interfaces';
 import { addBreakpointListener, cleanupBreakpointListener } from '@growi/ui/dist/utils';
 import { useRouter } from 'next/router';
 import type { HtmlElementNode } from 'rehype-toc';
-import type { MutatorOptions } from 'swr';
 import {
-  useSWRConfig, type SWRResponse, type Key,
+  useSWRConfig, type SWRResponse, type Key, type MutatorOptions,
 } from 'swr';
 import useSWRImmutable from 'swr/immutable';
 
@@ -20,14 +19,14 @@ import { scheduleToPut } from '~/client/services/user-ui-settings';
 import type { IPageSelectedGrant } from '~/interfaces/page';
 import { SidebarContentsType, SidebarMode } from '~/interfaces/ui';
 import type { UpdateDescCountData } from '~/interfaces/websocket';
+import {
+  useIsNotFound, useCurrentPagePath, useIsTrashPage, useCurrentPageId,
+} from '~/stores/page';
 import {
   useIsEditable, useIsReadOnlyUser,
   useIsSharedUser, useIsIdenticalPath, useCurrentUser, useShareLinkId,
 } from '~/stores-universal/context';
 import { EditorMode, useEditorMode } from '~/stores-universal/ui';
-import {
-  useIsNotFound, useCurrentPagePath, useIsTrashPage, useCurrentPageId,
-} from '~/stores/page';
 import loggerFactory from '~/utils/logger';
 
 import { useStaticSWR } from './use-static-swr';

+ 2 - 3
apps/app/test/integration/service/user-groups.test.ts

@@ -1,16 +1,15 @@
 
-import type { IGrantedGroup } from '@growi/core';
 import {
-  PageGrant, type IPage, GroupType, getIdForRef,
+  PageGrant, type IPage, type IGrantedGroup, GroupType, getIdForRef,
 } from '@growi/core';
 import mongoose from 'mongoose';
 
+import { PageActionOnGroupDelete } from '../../../src/interfaces/user-group';
 import type { PageDocument, PageModel } from '../../../src/server/models/page';
 import UserGroup from '../../../src/server/models/user-group';
 import UserGroupRelation from '../../../src/server/models/user-group-relation';
 import type { IUserGroupService } from '../../../src/server/service/user-group';
 import { getInstance } from '../setup-crowi';
-import { PageActionOnGroupDelete } from '../../../src/interfaces/user-group';
 
 describe('UserGroupService', () => {
   let crowi;