Skip to content

Commit a1691a3

Browse files
committed
Es lint fixes
1 parent 5985cbb commit a1691a3

10 files changed

Lines changed: 73 additions & 64 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ interface Props {
2929
runCmdPlaceholder?: string;
3030

3131
// Unified handlers
32-
setField: (field: string, value: any) => void;
32+
setField: (field: string, value: unknown) => void;
3333
onSourceValueChanged: (arg0: ServiceSource) => void;
3434
onRemoteValueChanged: (arg0: Remote) => void;
3535
onRuntimeValueChanged: (arg0: Runtime) => void;

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

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

2020
export function CreateServicePage2({

resources/js/hooks/use-deployments.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useRemotes } from '@/hooks/use-remotes';
2-
import { toast } from '@/lib/toast';
32
import type { Blueprint, Service } from '@/types';
43
import { useQuery } from '@tanstack/react-query';
54
import axios from 'axios';

resources/js/hooks/use-images.ts

Lines changed: 4 additions & 3 deletions
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

@@ -43,8 +43,9 @@ export function useImages(setOpen?: (open: boolean) => void) {
4343
return { image_registry: imageRegistry };
4444
};
4545

46-
const handleFormSuccess = (page: any) => {
47-
const data = page?.props?.flash?.data ?? [];
46+
const handleFormSuccess = (page: unknown) => {
47+
const pageData = page as { props?: { flash?: { data?: unknown[] } } };
48+
const data = pageData?.props?.flash?.data ?? [];
4849
if (!searchComplete && Array.isArray(data) && data.length > 0) {
4950
setSearchComplete(true);
5051
} else if (searchComplete) {

resources/js/hooks/use-remotes.ts

Lines changed: 4 additions & 3 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) => {
@@ -53,8 +53,9 @@ export function useRemotes(setOpen?: (open: boolean) => void) {
5353
return searchComplete ? { remote_repo: remoteRepo, branch: selectedBranch } : { remote_repo: remoteRepo };
5454
};
5555

56-
const handleFormSuccess = (page: any) => {
57-
const data = page?.props?.flash?.data ?? [];
56+
const handleFormSuccess = (page: unknown) => {
57+
const pageData = page as { props?: { flash?: { data?: string[] } } };
58+
const data = pageData?.props?.flash?.data ?? [];
5859
if (!searchComplete && Array.isArray(data) && data.length > 0) {
5960
setBranches(data);
6061
setSearchComplete(true);

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,15 @@ function serviceFormReducer(state: ServiceFormState, action: ServiceFormAction):
7777
switch (action.type) {
7878
case 'SET_CURRENT_PAGE':
7979
return { ...state, currentPage: action.payload };
80-
case 'SET_FIELD':
80+
case 'SET_FIELD': {
8181
const { field, value } = action.payload;
8282
const errorField = `${field}Error` as keyof ServiceFormState;
8383
return {
8484
...state,
8585
[field]: value,
8686
...(errorField in state && { [errorField]: '' }),
8787
};
88+
}
8889
case 'SET_ERROR':
8990
return { ...state, [action.payload.field]: action.payload.value };
9091
case 'CLEAR_ALL_ERRORS':
@@ -331,27 +332,34 @@ export function useServiceForm() {
331332
setField('runtime', value);
332333

333334
switch (value) {
334-
case 'node-js':
335+
case 'node-js': {
335336
setField('runCmdPlaceholder', 'npm run start');
336337
break;
337-
case 'python':
338+
}
339+
case 'python': {
338340
setField('runCmdPlaceholder', 'python app.py');
339341
break;
340-
case 'ruby':
342+
}
343+
case 'ruby': {
341344
setField('runCmdPlaceholder', 'ruby app.rb');
342345
break;
343-
case 'php':
346+
}
347+
case 'php': {
344348
setField('runCmdPlaceholder', 'php -S localhost:8000 -t public');
345349
break;
346-
case 'go':
350+
}
351+
case 'go': {
347352
setField('runCmdPlaceholder', './app');
348353
break;
349-
case 'static':
354+
}
355+
case 'static': {
350356
setField('runCmdPlaceholder', 'npm run build');
351357
setField('port', 80);
352358
break;
353-
default:
359+
}
360+
default: {
354361
setField('runCmdPlaceholder', 'npm run start');
362+
}
355363
}
356364
};
357365

resources/js/layouts/settings/layout.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ const sidebarNavItems: NavItem[] = [
3232
];
3333

3434
export default function SettingsLayout({ children }: PropsWithChildren) {
35+
const currentPath = typeof window !== 'undefined' ? window.location.pathname : '';
36+
const { version } = usePage().props;
37+
3538
// When server-side rendering, we only render the layout on the client...
3639
if (typeof window === 'undefined') {
3740
return null;
3841
}
3942

40-
const currentPath = window.location.pathname;
41-
const { version } = usePage().props;
42-
4343
return (
4444
<div className="flex flex-1 flex-col items-center px-4 py-6">
4545
<div className="flex w-full max-w-6xl flex-col lg:flex-row lg:space-x-12">

resources/js/pages/projects/services/deploy-service.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
AlertDialogTitle,
1313
} from '@/components/ui/alert-dialog';
1414
import { Button } from '@/components/ui/button';
15-
import { useFlashToast } from '@/hooks/use-flash-toast';
15+
1616
import { useRemotes } from '@/hooks/use-remotes';
1717
import { useServiceForm } from '@/hooks/use-service-form';
1818
import AppLayout from '@/layouts/app-layout';

resources/js/pages/projects/services/index.tsx

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { StatusChip } from '@/components/status-chip';
22
import { Button } from '@/components/ui/button';
33
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from '@/components/ui/empty';
44
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
5-
import { useProjects } from '@/hooks/use-projects';
5+
66
import { useServices } from '@/hooks/use-services';
77
import AppLayout from '@/layouts/app-layout';
88
import { getRuntimeIcon } from '@/lib/runtime-icon';
@@ -120,44 +120,44 @@ export default function Services() {
120120
<TableBody>
121121
{!isLoading
122122
? paginatedServices!.map((service) => (
123-
<TableRow key={service.id} className="h-16">
124-
<TableCell className="h-16 align-middle font-medium">{service.name}</TableCell>
125-
<TableCell className="h-16 align-middle">
126-
<StatusChip status={service.status} />
127-
</TableCell>
128-
<TableCell className="h-16 align-middle">
129-
<div className="flex items-center gap-2">
130-
{getRuntimeIcon(service.runtime)}
131-
<span>{service.runtime}</span>
132-
</div>
133-
</TableCell>
134-
<TableCell className="h-16 align-middle">{service.region}</TableCell>
135-
<TableCell className="h-16 w-[200px] text-right align-middle">
136-
{service.last_deployed instanceof Date
137-
? service.last_deployed.toLocaleString()
138-
: service.last_deployed}
139-
</TableCell>
140-
</TableRow>
141-
))
123+
<TableRow key={service.id} className="h-16">
124+
<TableCell className="h-16 align-middle font-medium">{service.name}</TableCell>
125+
<TableCell className="h-16 align-middle">
126+
<StatusChip status={service.status} />
127+
</TableCell>
128+
<TableCell className="h-16 align-middle">
129+
<div className="flex items-center gap-2">
130+
{getRuntimeIcon(service.runtime)}
131+
<span>{service.runtime}</span>
132+
</div>
133+
</TableCell>
134+
<TableCell className="h-16 align-middle">{service.region}</TableCell>
135+
<TableCell className="h-16 w-[200px] text-right align-middle">
136+
{service.last_deployed instanceof Date
137+
? service.last_deployed.toLocaleString()
138+
: service.last_deployed}
139+
</TableCell>
140+
</TableRow>
141+
))
142142
: Array.from({ length: 3 }).map((_, idx) => (
143-
<TableRow key={`skeleton-${idx}`} className="h-16">
144-
<TableCell className="h-16 max-w-[240px] overflow-hidden align-middle font-medium">
145-
<div className="h-4 w-32 animate-pulse rounded bg-muted" />
146-
</TableCell>
147-
<TableCell className="h-16 align-middle">
148-
<div className="h-4 w-16 animate-pulse rounded bg-muted" />
149-
</TableCell>
150-
<TableCell className="h-16 align-middle">
151-
<div className="h-4 w-20 animate-pulse rounded bg-muted" />
152-
</TableCell>
153-
<TableCell className="h-16 max-w-[320px] overflow-hidden align-middle">
154-
<div className="h-4 w-40 animate-pulse rounded bg-muted" />
155-
</TableCell>
156-
<TableCell className="h-16 w-[200px] overflow-hidden text-right align-middle">
157-
<div className="ml-auto h-4 w-24 animate-pulse rounded bg-muted" />
158-
</TableCell>
159-
</TableRow>
160-
))}
143+
<TableRow key={`skeleton-${idx}`} className="h-16">
144+
<TableCell className="h-16 max-w-[240px] overflow-hidden align-middle font-medium">
145+
<div className="h-4 w-32 animate-pulse rounded bg-muted" />
146+
</TableCell>
147+
<TableCell className="h-16 align-middle">
148+
<div className="h-4 w-16 animate-pulse rounded bg-muted" />
149+
</TableCell>
150+
<TableCell className="h-16 align-middle">
151+
<div className="h-4 w-20 animate-pulse rounded bg-muted" />
152+
</TableCell>
153+
<TableCell className="h-16 max-w-[320px] overflow-hidden align-middle">
154+
<div className="h-4 w-40 animate-pulse rounded bg-muted" />
155+
</TableCell>
156+
<TableCell className="h-16 w-[200px] overflow-hidden text-right align-middle">
157+
<div className="ml-auto h-4 w-24 animate-pulse rounded bg-muted" />
158+
</TableCell>
159+
</TableRow>
160+
))}
161161
</TableBody>
162162
</Table>
163163

@@ -166,8 +166,8 @@ export default function Services() {
166166
{(services ?? []).length === 0
167167
? 'No services found'
168168
: services!.length === 1
169-
? 'Showing 1 of 1 service'
170-
: `Showing ${startIndex + 1} to ${Math.min(endIndex, services?.length ?? 0)} of ${services?.length ?? 0} services`}{' '}
169+
? 'Showing 1 of 1 service'
170+
: `Showing ${startIndex + 1} to ${Math.min(endIndex, services?.length ?? 0)} of ${services?.length ?? 0} services`}{' '}
171171
</div>
172172
<div className="flex items-center space-x-2">
173173
<Button

resources/js/pages/settings/config.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import AppLayout from '@/layouts/app-layout';
66
import SettingsLayout from '@/layouts/settings/layout';
77
import { toWordUpperCase } from '@/lib/utils';
88
import { config } from '@/routes';
9-
import { type BreadcrumbItem, type SharedData } from '@/types';
9+
import { type BreadcrumbItem } from '@/types';
1010
import { Head, router, usePage } from '@inertiajs/react';
1111
import { useState } from 'react';
1212

@@ -18,7 +18,7 @@ const breadcrumbs: BreadcrumbItem[] = [
1818
];
1919

2020
export default function Config() {
21-
const { config }: Record<string, any> = usePage().props;
21+
const { config }: Record<string, unknown> = usePage().props;
2222
const [editingKey, setEditingKey] = useState<string | null>(null);
2323
const [editValue, setEditValue] = useState<string>('');
2424

@@ -79,7 +79,7 @@ export default function Config() {
7979
value !== '' &&
8080
value !== false &&
8181
value !== 0;
82-
82+
8383
let lastUpdated: string | null = null;
8484
if (isSet) {
8585
if (

0 commit comments

Comments
 (0)