Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESLint Rules to Ensure Proper Code Compliance #392

Merged
merged 3 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backend/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions backend/src/documents/documents.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ describe("DocumentsService", () => {
});

it("should be defined", async () => {
prismaService;

expect(documentsService).toBeDefined();
});

Expand Down
4 changes: 2 additions & 2 deletions backend/src/documents/documents.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DocumentsService {
) {
throw new Error();
}
} catch (e) {
} catch {
throw new UnauthorizedException("Invalid sharing token");
}

Expand All @@ -42,7 +42,7 @@ export class DocumentsService {
id: documentId,
},
});
} catch (e) {
} catch {
throw new NotFoundException("Document not found");
}

Expand Down
4 changes: 2 additions & 2 deletions backend/src/files/files.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export class FilesService {
id: workspaceId,
},
});
} catch (e) {
} catch {
throw new UnauthorizedException("Client unauthorized.");
}

Expand Down Expand Up @@ -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.");
}
}
Expand Down
10 changes: 5 additions & 5 deletions backend/src/workspace-documents/workspace-documents.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand All @@ -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."
);
Expand Down Expand Up @@ -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."
);
Expand Down Expand Up @@ -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."
);
Expand Down Expand Up @@ -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."
);
Expand Down
2 changes: 1 addition & 1 deletion backend/src/workspace-users/workspace-users.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand Down
8 changes: 4 additions & 4 deletions backend/src/workspaces/workspaces.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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."
);
Expand Down Expand Up @@ -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."
);
Expand Down Expand Up @@ -154,7 +154,7 @@ export class WorkspacesService {
) {
throw new Error();
}
} catch (err) {
} catch {
throw new UnauthorizedException("Invitation token is invalid or expired.");
}

Expand All @@ -164,7 +164,7 @@ export class WorkspacesService {
id: workspaceId,
},
});
} catch (e) {
} catch {
throw new NotFoundException("The workspace is deleted.");
}
devleejb marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
4 changes: 3 additions & 1 deletion frontend/eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
devleejb marked this conversation as resolved.
Show resolved Hide resolved
},
settings: {
react: {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/modals/ChangeNicknameModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useMemo, useState } from "react";
import { useDebounce } from "react-use";
import { useUpdateUserNicknameMutation } from "../../hooks/api/user";

interface ChangeNicknameModalProps extends Omit<ModalProps, "children"> {}
type ChangeNicknameModalProps = Omit<ModalProps, "children">;

function ChangeNicknameModal(props: ChangeNicknameModalProps) {
const [nickname, setNickname] = useState("");
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/modals/ShareModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ModalProps, "children"> {}
type ShareModalProps = Omit<ModalProps, "children">;
devleejb marked this conversation as resolved.
Show resolved Hide resolved

function ShareModal(props: ShareModalProps) {
const { ...modalProps } = props;
Expand Down
23 changes: 13 additions & 10 deletions frontend/src/hooks/useYorkieDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
devleejb marked this conversation as resolved.
Show resolved Hide resolved
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) => {
Expand Down