Skip to content

Commit e07674f

Browse files
committed
[Feature]: Update git hooks and package json #2705
1 parent 10a0bbf commit e07674f

6 files changed

Lines changed: 12 additions & 41 deletions

File tree

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": "cross-env NODE_ENV=production webpack build --config webpack.config.js",
1313
"build-sky": "cross-env NODE_ENV=production UI_VERSION=sky webpack build --config webpack.config.js",
1414
"eslint": "eslint ./src --ext .js,.jsx,.ts,.tsx",
15-
"eslint-fix": "eslint ./src --ext .js,.jsx,.ts,.tsx --fix --max-warnings=0",
15+
"eslint-fix": "eslint ./src --ext .js,.jsx,.ts,.tsx --fix",
1616
"test": "jest",
1717
"test:update-snapshots": "jest -u",
1818
"generate-api": "npx @rtk-query/codegen-openapi openapi-config.ts",
@@ -130,7 +130,7 @@
130130
},
131131
"lint-staged": {
132132
"*.{js,jsx,ts,tsx}": [
133-
"eslint --fix",
133+
"eslint --fix --max-warnings=0",
134134
"git add"
135135
]
136136
}

frontend/src/pages/Project/Details/Settings/index.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
SelectCSD,
1818
SpaceBetween,
1919
StatusIndicator,
20-
Toggle,
2120
} from 'components';
2221
import { HotspotIds } from 'layouts/AppLayout/TutorialPanel/constants';
2322

@@ -79,7 +78,6 @@ export const ProjectSettings: React.FC = () => {
7978
{ label: t('projects.edit.visibility.public') || '', value: 'public' },
8079
];
8180

82-
const currentVisibility = data?.isPublic ? 'public' : 'private';
8381
const [selectedVisibility, setSelectedVisibility] = useState(data?.isPublic ? visibilityOptions[1] : visibilityOptions[0]);
8482

8583
useEffect(() => {
@@ -121,6 +119,7 @@ export const ProjectSettings: React.FC = () => {
121119
content: t('projects.edit.update_members_success'),
122120
});
123121
})
122+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
124123
.catch((error: any) => {
125124
pushNotification({
126125
type: 'error',
@@ -143,6 +142,7 @@ export const ProjectSettings: React.FC = () => {
143142
content: t('projects.edit.update_visibility_success'),
144143
});
145144
})
145+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
146146
.catch((error: any) => {
147147
pushNotification({
148148
type: 'error',
@@ -160,6 +160,7 @@ export const ProjectSettings: React.FC = () => {
160160

161161
deleteProject(data)
162162
.then(() => navigate(ROUTES.PROJECT.LIST))
163+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
163164
.catch((error: any) => {
164165
console.error('Delete project failed:', error);
165166
});

frontend/src/pages/Project/Details/index.tsx

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,11 @@
1-
import React, { useMemo } from 'react';
2-
import { useTranslation } from 'react-i18next';
3-
import { Outlet, useNavigate, useParams } from 'react-router-dom';
1+
import React from 'react';
2+
import { Outlet, useParams } from 'react-router-dom';
43

5-
import { Button, ContentLayout, DetailsHeader } from 'components';
6-
7-
import { useAppSelector, useNotifications } from 'hooks';
8-
import { ROUTES } from 'routes';
9-
import { useAddProjectMemberMutation, useGetProjectQuery, useRemoveProjectMemberMutation } from 'services/project';
10-
11-
import { selectUserData } from 'App/slice';
12-
13-
import { useProjectMemberActions } from '../hooks/useProjectMemberActions';
14-
import { getProjectRoleByUserName } from '../utils';
4+
import { ContentLayout, DetailsHeader } from 'components';
155

166
export const ProjectDetails: React.FC = () => {
17-
const { t } = useTranslation();
187
const params = useParams();
19-
const navigate = useNavigate();
208
const paramProjectName = params.projectName ?? '';
21-
const userData = useAppSelector(selectUserData);
22-
const { handleJoinProject, handleLeaveProject, isMemberActionLoading } = useProjectMemberActions();
23-
24-
const { data: project } = useGetProjectQuery({ name: paramProjectName });
25-
26-
const currentUserRole = useMemo(() => {
27-
if (!userData?.username || !project) return null;
28-
return getProjectRoleByUserName(project, userData.username);
29-
}, [project, userData?.username]);
30-
31-
const isProjectOwner = userData?.username === project?.owner.username;
32-
33-
const isMember = currentUserRole !== null;
349

3510
return (
3611
<ContentLayout header={<DetailsHeader title={paramProjectName} />}>

frontend/src/pages/Project/Members/index.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React, { useEffect, useMemo, useState } from 'react';
22
import { useFieldArray, useForm } from 'react-hook-form';
33
import { useTranslation } from 'react-i18next';
4-
import { useNavigate } from 'react-router-dom';
54

65
import {
76
Button,
@@ -15,7 +14,7 @@ import {
1514
Table,
1615
} from 'components';
1716

18-
import { useAppSelector, useCollection, useNotifications } from 'hooks';
17+
import { useAppSelector, useCollection } from 'hooks';
1918
import { ROUTES } from 'routes';
2019
import { useGetUserListQuery } from 'services/user';
2120

@@ -32,8 +31,6 @@ import styles from './styles.module.scss';
3231

3332
export const ProjectMembers: React.FC<IProps> = ({ members, loading, onChange, readonly, isAdmin, project }) => {
3433
const { t } = useTranslation();
35-
const navigate = useNavigate();
36-
const [pushNotification] = useNotifications();
3734
const [selectedItems, setSelectedItems] = useState<TProjectMemberWithIndex[]>([]);
3835
const { data: usersData } = useGetUserListQuery();
3936
const userData = useAppSelector(selectUserData);
@@ -54,8 +51,6 @@ export const ProjectMembers: React.FC<IProps> = ({ members, loading, onChange, r
5451
return member?.project_role || null;
5552
}, [members, userData?.username]);
5653

57-
const isProjectOwner = userData?.username === project?.owner.username;
58-
5954
const isMember = currentUserRole !== null;
6055

6156
useEffect(() => {

frontend/src/pages/Project/hooks/useProjectMemberActions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { useTranslation } from 'react-i18next';
2-
import { useNavigate } from 'react-router-dom';
32

43
import { useNotifications } from 'hooks';
5-
import { ROUTES } from 'routes';
64
import { useAddProjectMemberMutation, useRemoveProjectMemberMutation } from 'services/project';
75

86
export const useProjectMemberActions = () => {
97
const { t } = useTranslation();
10-
const navigate = useNavigate();
118
const [pushNotification] = useNotifications();
129
const [addMember, { isLoading: isAdding }] = useAddProjectMemberMutation();
1310
const [removeMember, { isLoading: isRemoving }] = useRemoveProjectMemberMutation();
@@ -51,6 +48,7 @@ export const useProjectMemberActions = () => {
5148

5249
// Optionally call the success callback
5350
onLeaveSuccess?.();
51+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5452
} catch (error: any) {
5553
console.error('Failed to leave project:', error);
5654

frontend/src/services/project.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { base64ToArrayBuffer } from 'libs';
55
import fetchBaseQueryHeaders from 'libs/fetchBaseQueryHeaders';
66

77
// Helper function to transform backend response to frontend format
8+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
89
const transformProjectResponse = (project: any): IProject => ({
910
...project,
1011
isPublic: project.is_public,
@@ -28,6 +29,7 @@ export const projectApi = createApi({
2829
};
2930
},
3031

32+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3133
transformResponse: (response: any[]): IProject[] => response.map(transformProjectResponse),
3234

3335
providesTags: (result) =>

0 commit comments

Comments
 (0)