diff --git a/backend/eslint.config.mjs b/backend/eslint.config.mjs index 990d0140..53a931cb 100644 --- a/backend/eslint.config.mjs +++ b/backend/eslint.config.mjs @@ -20,6 +20,8 @@ export default [ prettier: prettierPlugin, }, rules: { + ...typescriptPlugin.configs.recommended.rules, + ...prettierPlugin.configs.recommended.rules, "@typescript-eslint/interface-name-prefix": "off", "@typescript-eslint/explicit-function-return-type": "off", "@typescript-eslint/explicit-module-boundary-types": "off", diff --git a/backend/src/documents/documents.service.spec.ts b/backend/src/documents/documents.service.spec.ts index d2d34123..188273ea 100644 --- a/backend/src/documents/documents.service.spec.ts +++ b/backend/src/documents/documents.service.spec.ts @@ -32,8 +32,6 @@ describe("DocumentsService", () => { }); it("should be defined", async () => { - prismaService; - expect(documentsService).toBeDefined(); }); diff --git a/backend/src/documents/documents.service.ts b/backend/src/documents/documents.service.ts index dec88286..b38ce35d 100644 --- a/backend/src/documents/documents.service.ts +++ b/backend/src/documents/documents.service.ts @@ -30,7 +30,7 @@ export class DocumentsService { ) { throw new Error(); } - } catch (e) { + } catch { throw new UnauthorizedException("Invalid sharing token"); } @@ -42,7 +42,7 @@ export class DocumentsService { id: documentId, }, }); - } catch (e) { + } catch { throw new NotFoundException("Document not found"); } diff --git a/backend/src/files/files.service.ts b/backend/src/files/files.service.ts index 6c378d59..cc47bb2a 100644 --- a/backend/src/files/files.service.ts +++ b/backend/src/files/files.service.ts @@ -45,7 +45,7 @@ export class FilesService { id: workspaceId, }, }); - } catch (e) { + } catch { throw new UnauthorizedException("Client unauthorized."); } @@ -74,7 +74,7 @@ export class FilesService { Key: fileKey, }); return getSignedUrl(this.s3Client, command, { expiresIn: 3600 }); - } catch (e) { + } catch { throw new NotFoundException("File not found."); } } diff --git a/backend/src/workspace-documents/workspace-documents.service.ts b/backend/src/workspace-documents/workspace-documents.service.ts index 1b100674..f44dd749 100644 --- a/backend/src/workspace-documents/workspace-documents.service.ts +++ b/backend/src/workspace-documents/workspace-documents.service.ts @@ -30,7 +30,7 @@ export class WorkspaceDocumentsService { workspaceId, }, }); - } catch (e) { + } catch { throw new NotFoundException( "The workspace does not exist, or the user lacks the appropriate permissions." ); @@ -50,7 +50,7 @@ export class WorkspaceDocumentsService { workspaceId, }, }); - } catch (e) { + } catch { throw new NotFoundException( "The workspace does not exist, or the user lacks the appropriate permissions." ); @@ -78,7 +78,7 @@ export class WorkspaceDocumentsService { workspaceId, }, }); - } catch (e) { + } catch { throw new NotFoundException( "The workspace does not exist, or the user lacks the appropriate permissions." ); @@ -146,7 +146,7 @@ export class WorkspaceDocumentsService { }, }); return document; - } catch (e) { + } catch { throw new NotFoundException( "The workspace or document does not exist, or the user lacks the appropriate permissions." ); @@ -176,7 +176,7 @@ export class WorkspaceDocumentsService { workspaceId, }, }); - } catch (e) { + } catch { throw new NotFoundException( "The workspace or document does not exist, or the user lacks the appropriate permissions." ); diff --git a/backend/src/workspace-users/workspace-users.service.ts b/backend/src/workspace-users/workspace-users.service.ts index dd2ff0bc..0489ced1 100644 --- a/backend/src/workspace-users/workspace-users.service.ts +++ b/backend/src/workspace-users/workspace-users.service.ts @@ -20,7 +20,7 @@ export class WorkspaceUsersService { workspaceId, }, }); - } catch (e) { + } catch { throw new NotFoundException( "The workspace does not exist, or the user lacks the appropriate permissions." ); diff --git a/backend/src/workspaces/workspaces.service.ts b/backend/src/workspaces/workspaces.service.ts index 6d9a6cce..f011f043 100644 --- a/backend/src/workspaces/workspaces.service.ts +++ b/backend/src/workspaces/workspaces.service.ts @@ -61,7 +61,7 @@ export class WorkspacesService { }); return foundWorkspace; - } catch (e) { + } catch { throw new NotFoundException( "Workspace not found, or the user lacks the appropriate permissions." ); @@ -114,7 +114,7 @@ export class WorkspacesService { workspaceId, }, }); - } catch (e) { + } catch { throw new NotFoundException( "Worksapce does not exist, or the user lacks the appropriate permissions." ); @@ -154,7 +154,7 @@ export class WorkspacesService { ) { throw new Error(); } - } catch (err) { + } catch { throw new UnauthorizedException("Invitation token is invalid or expired."); } @@ -164,7 +164,7 @@ export class WorkspacesService { id: workspaceId, }, }); - } catch (e) { + } catch { throw new NotFoundException("The workspace is deleted."); } diff --git a/frontend/eslint.config.mjs b/frontend/eslint.config.mjs index d6c4a63b..f1fd522c 100755 --- a/frontend/eslint.config.mjs +++ b/frontend/eslint.config.mjs @@ -25,7 +25,9 @@ export default [ }, rules: { "react-refresh/only-export-components": ["warn", { allowConstantExport: true }], - "prettier/prettier": "error", + ...reactHooksPlugin.configs.recommended.rules, + ...prettierPlugin.configs.recommended.rules, + ...typescriptPlugin.configs.recommended.rules, }, settings: { react: { diff --git a/frontend/src/components/modals/ChangeNicknameModal.tsx b/frontend/src/components/modals/ChangeNicknameModal.tsx index 2c151809..73472804 100644 --- a/frontend/src/components/modals/ChangeNicknameModal.tsx +++ b/frontend/src/components/modals/ChangeNicknameModal.tsx @@ -5,7 +5,7 @@ import { useMemo, useState } from "react"; import { useDebounce } from "react-use"; import { useUpdateUserNicknameMutation } from "../../hooks/api/user"; -interface ChangeNicknameModalProps extends Omit {} +type ChangeNicknameModalProps = Omit; function ChangeNicknameModal(props: ChangeNicknameModalProps) { const [nickname, setNickname] = useState(""); diff --git a/frontend/src/components/modals/ShareModal.tsx b/frontend/src/components/modals/ShareModal.tsx index 8f94fc57..43069b84 100644 --- a/frontend/src/components/modals/ShareModal.tsx +++ b/frontend/src/components/modals/ShareModal.tsx @@ -23,7 +23,7 @@ import CloseIcon from "@mui/icons-material/Close"; import { useSelector } from "react-redux"; import { selectDocument } from "../../store/documentSlice"; -interface ShareModalProps extends Omit {} +type ShareModalProps = Omit; function ShareModal(props: ShareModalProps) { const { ...modalProps } = props; diff --git a/frontend/src/hooks/useYorkieDocument.ts b/frontend/src/hooks/useYorkieDocument.ts index 60cf4270..300f78dd 100644 --- a/frontend/src/hooks/useYorkieDocument.ts +++ b/frontend/src/hooks/useYorkieDocument.ts @@ -27,16 +27,19 @@ export const useYorkieDocument = ( return shareToken ? `share:${shareToken}` : `default:${authStore.accessToken}`; }, [authStore.accessToken, searchParams]); - const createYorkieClient = useCallback(async (yorkieToken: string) => { - const syncLoopDuration = Number(searchParams.get("syncLoopDuration")) || 200; - const newClient = new yorkie.Client(YORKIE_API_ADDR, { - apiKey: YORKIE_API_KEY, - token: yorkieToken, - syncLoopDuration, - }); - await newClient.activate(); - return newClient; - }, []); + const createYorkieClient = useCallback( + async (yorkieToken: string) => { + const syncLoopDuration = Number(searchParams.get("syncLoopDuration")) || 200; + const newClient = new yorkie.Client(YORKIE_API_ADDR, { + apiKey: YORKIE_API_KEY, + token: yorkieToken, + syncLoopDuration, + }); + await newClient.activate(); + return newClient; + }, + [searchParams] + ); const createYorkieDocument = useCallback( (client: yorkie.Client, yorkieDocumentId: string, presenceName: string) => {