Skip to content

Commit 5985cbb

Browse files
committed
eslint fixes
1 parent c1d73de commit 5985cbb

18 files changed

Lines changed: 72 additions & 68 deletions

File tree

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ jobs:
4040
run: vendor/bin/pint --test
4141

4242
- name: Lint Frontend
43-
run: pnpm run format:check
43+
run: pnpm run format:check && pnpm run lint

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
"@php artisan test"
6767
],
6868
"lint": [
69+
"vendor/bin/pint"
70+
],
71+
"lint:check": [
6972
"vendor/bin/pint --test"
7073
],
7174
"sync": [

resources/js/components/blueprint.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface Props {
1111
handleBlueprintCopy: () => void;
1212
}
1313

14-
export function Blueprint({ name, yamlConfig, jsonConfig, blueprintFormat, setBlueprintFormat, handleBlueprintCopy }: Props) {
14+
export function Blueprint({ yamlConfig, jsonConfig, blueprintFormat, setBlueprintFormat, handleBlueprintCopy }: Props) {
1515
return (
1616
<>
1717
<div className="mb-4 flex items-center justify-between">

resources/js/components/create-service/create-service-page-1.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ interface Props {
2525
runCmdError: string;
2626
source: ServiceSource;
2727
processing: boolean;
28-
errors: any;
28+
errors: Record<string, string>;
2929
runCmdPlaceholder?: string;
3030

3131
// Unified handlers

resources/js/components/create-service/create-service-page-2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface Props {
1313
dnsProvider: string;
1414
dnsProviderError: string;
1515
processing: boolean;
16-
errors: any;
16+
errors: Record<string, string>;
1717
setField: (field: string, value: any) => void;
1818
}
1919

resources/js/components/image-add-dialog.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,11 @@ interface Props {
1313

1414
export default function ImageAddDialog({ open, setOpen }: Props) {
1515
const {
16-
branches,
1716
searchComplete,
1817
validationError,
1918
remoteRepo,
2019
selectedBranch,
2120
setRemoteRepo,
22-
setSelectedBranch,
2321
getFormAction,
2422
getFormData,
2523
handleFormSuccess,

resources/js/hooks/use-deployments.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useRemotes } from '@/hooks/use-remotes';
2+
import { toast } from '@/lib/toast';
23
import type { Blueprint, Service } from '@/types';
34
import { useQuery } from '@tanstack/react-query';
45
import axios from 'axios';
@@ -16,13 +17,14 @@ export function useDeployments() {
1617
params: Object.fromEntries(params),
1718
});
1819
return response.data;
19-
} catch (error) {}
20+
} catch (error) {
21+
console.error((error as Error).message || "An unknown error occoured while retrieving deployments")
22+
}
2023
},
2124
staleTime: 5 * 60 * 1000,
2225
});
2326

2427
const { remotes } = useRemotes();
25-
const remotesData = remotes || [];
2628
const [currentPage, setCurrentPage] = useState(1);
2729
const itemsPerPage = 8;
2830
const totalPages = Math.ceil((deployments?.length ?? 0) / itemsPerPage);
@@ -38,11 +40,11 @@ export function useDeployments() {
3840
const remote = (config as Partial<Service>)?.remote;
3941
let resolvedRemote = remote;
4042
if (remote) {
41-
resolvedRemote = remotesData.find((r) => r) || remote;
43+
resolvedRemote = remotes.find((r) => r) || remote;
4244
}
4345
return { ...deployment, config: { ...config, remote: resolvedRemote } };
4446
}),
45-
[paginatedDeployments, remotesData],
47+
[paginatedDeployments, remotes],
4648
);
4749

4850
const goToPage = (page: number) => {

resources/js/hooks/use-images.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function useImages(setOpen?: (open: boolean) => void) {
1414
image_registry: z
1515
.string()
1616
.min(1, 'Domain is required')
17-
.regex(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/, 'Please enter a valid docker image registry'),
17+
.regex(/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w .-]*)*\/?$/, 'Please enter a valid docker image registry'),
1818
branch: z.string().optional(),
1919
});
2020

resources/js/hooks/use-remotes.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export function useRemotes(setOpen?: (open: boolean) => void) {
1717
remote_repo: z
1818
.string()
1919
.min(1, 'Domain is required')
20-
.regex(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/, 'Please enter a valid remote address'),
20+
.regex(/^(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([\/\w .-]*)*\/?$/, 'Please enter a valid remote address'),
2121
branch: z.string().optional(),
2222
})
2323
.refine((data) => {
@@ -64,14 +64,6 @@ export function useRemotes(setOpen?: (open: boolean) => void) {
6464
}
6565
};
6666

67-
const reset = () => {
68-
setRemoteRepo('');
69-
setSelectedBranch('');
70-
setBranches([]);
71-
setSearchComplete(false);
72-
setError('');
73-
};
74-
7567
const { data, isLoading } = useQuery<Remote[]>({
7668
queryKey: ['remotes'],
7769
queryFn: async () => {
@@ -83,7 +75,7 @@ export function useRemotes(setOpen?: (open: boolean) => void) {
8375

8476
return {
8577
// State
86-
remotes: data,
78+
remotes: data || [],
8779
isLoading,
8880
branches,
8981
searchComplete,

resources/js/hooks/use-service-form.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ interface ServiceFormState {
3636

3737
type ServiceFormAction =
3838
| { type: 'SET_CURRENT_PAGE'; payload: number }
39-
| { type: 'SET_FIELD'; payload: { field: string; value: any } }
39+
| { type: 'SET_FIELD'; payload: { field: string; value: unknown } }
4040
| { type: 'SET_ERROR'; payload: { field: string; value: string } }
4141
| { type: 'CLEAR_ALL_ERRORS' }
4242
| { type: 'NEXT_PAGE' }
@@ -139,7 +139,7 @@ function serviceFormReducer(state: ServiceFormState, action: ServiceFormAction):
139139
}
140140
}
141141

142-
export function useServiceForm(onCreateServiceCallback?: () => void | null) {
142+
export function useServiceForm() {
143143
const [state, dispatch] = useReducer(serviceFormReducer, initialState);
144144
const [blueprintFormat, setBlueprintFormat] = useState<BlueprintFormat>('yaml');
145145

@@ -311,7 +311,7 @@ export function useServiceForm(onCreateServiceCallback?: () => void | null) {
311311
dispatch({ type: 'SKIP_TO_CONFIRMATION' });
312312
};
313313

314-
const setField = (field: string, value: any) => {
314+
const setField = (field: string, value: unknown) => {
315315
dispatch({ type: 'SET_FIELD', payload: { field, value } });
316316
};
317317

@@ -388,7 +388,9 @@ export function useServiceForm(onCreateServiceCallback?: () => void | null) {
388388
try {
389389
if (!currentBlueprint) return;
390390
await navigator.clipboard.writeText(blueprintFormat === 'yaml' ? yamlConfig : jsonConfig);
391-
} catch (err) {}
391+
} catch (error) {
392+
console.error((error as Error).message || "An unknown error occoured while retrieving blueprints")
393+
}
392394
};
393395

394396
return {

0 commit comments

Comments
 (0)