chore: enable the @typescript-eslint/explicit-function-return-type for renderer part (#10705)

* fix: eslint config
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: components
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: store
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: window mocks
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: components 2/x
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: components 3/x
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: rebase
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: components 5/x
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: components 6/x
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: typo
Signed-off-by: Philippe Martin <phmartin@redhat.com>

* fix: rebase
Signed-off-by: Philippe Martin <phmartin@redhat.com>
This commit is contained in:
Philippe Martin 2025-01-20 14:30:31 +01:00 committed by GitHub
parent 704bb31e14
commit bb1c3c0fbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
326 changed files with 1125 additions and 1146 deletions

View file

@ -305,7 +305,6 @@ export default [
rules: {
'@typescript-eslint/no-empty-function': 'off',
'no-undef': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'no-self-assign': 'off',
'sonarjs/no-empty-function': 'off',
'sonarjs/sonar-prefer-regexp-exec': 'off',

View file

@ -150,7 +150,7 @@ test('opens submenu when a `submenu` menu is opened', async () => {
link: '/tosubmenu',
tooltip: 'With submenu',
type: 'submenu',
get counter() {
get counter(): number {
return 0;
},
items: [{} as NavigationRegistryEntry],

View file

@ -119,7 +119,7 @@ window.events?.receive('navigate', (navigationRequest: unknown) => {
<CustomPick />
<CommandPalette />
<MessageBox />
<AppNavigation meta={meta} exitSettingsCallback={() => router.goto(nonSettingsPage)} />
<AppNavigation meta={meta} exitSettingsCallback={(): void => router.goto(nonSettingsPage)} />
{#if meta.url.startsWith('/preferences')}
<PreferencesNavigation meta={meta} />
{/if}

View file

@ -94,7 +94,7 @@ function onDidChangeConfigurationCallback(e: Event): void {
<div class="grow"></div>
<div bind:this={outsideWindow}>
<NavItem href="/accounts" tooltip="" bind:meta={meta} onClick={event => authActions?.onButtonClick(event)}>
<NavItem href="/accounts" tooltip="" bind:meta={meta} onClick={(event): void => authActions?.onButtonClick(event)}>
<Tooltip bottomRight tip="Accounts">
<div class="flex flex-col items-center w-full h-full">
<AccountIcon size={iconSize} />

View file

@ -32,7 +32,7 @@ import { lastPage } from './stores/breadcrumb';
// first, patch window object
const callbacks = new Map<string, any>();
const eventEmitter = {
receive: (message: string, callback: any) => {
receive: (message: string, callback: any): void => {
callbacks.set(message, callback);
},
};

View file

@ -30,7 +30,7 @@ onMount(async () => {
console.error('Unable to check if system is ready', error);
}
const checkRemoteStarted = async () => {
const checkRemoteStarted = async (): Promise<void> => {
const extensionsStarted = await window.extensionSystemIsExtensionsStarted();
if (extensionsStarted) {
window.dispatchEvent(new CustomEvent('extensions-already-started', {}));
@ -57,7 +57,7 @@ onDestroy(() => {
// receive events from main process to install a new extension
window.events?.receive('install-extension:from-id', (extensionId: unknown) => {
const action = async () => {
const action = async (): Promise<void> => {
const redirectPage = `/extensions/details/${extensionId}`;
// need to open the extension page
await tick();

View file

@ -33,7 +33,7 @@ const route = createRouteObject({
},
});
function processMetaBreadcrumbs(breadcrumbs?: Array<TinroBreadcrumb>) {
function processMetaBreadcrumbs(breadcrumbs?: Array<TinroBreadcrumb>): void {
if (breadcrumbs) {
const curPage = breadcrumbs[breadcrumbs.length - 1];
if (!curPage) return;

View file

@ -30,7 +30,7 @@ if (!pages[title]) {
</div>
<div class="h-full overflow-hidden hover:overflow-y-auto" style="margin-bottom:auto">
{#each items ?? [] as item}
<SettingsNavItem title={item.tooltip} href={item.link} selected={meta.url.startsWith(item.link)} onClick={() => pages[title] = item.link}
<SettingsNavItem title={item.tooltip} href={item.link} selected={meta.url.startsWith(item.link)} onClick={(): string => pages[title] = item.link}
></SettingsNavItem>
{/each}
</div>

View file

@ -32,7 +32,7 @@ export class TelemetryService {
private handlerFlusher: NodeJS.Timeout | undefined;
public handlePageOpen(pagePath: string) {
public handlePageOpen(pagePath: string): void {
this.handlePageClose();
this.handlerFlusher = setTimeout(() => {
@ -45,7 +45,7 @@ export class TelemetryService {
}
// clear timeout
public handlePageClose() {
public handlePageClose(): void {
if (this.handlerFlusher) {
clearTimeout(this.handlerFlusher);
this.handlerFlusher = undefined;

View file

@ -29,11 +29,11 @@ test('Object with single non serializable property', async () => {
});
test('Array with single non serializable property', async () => {
expect(removeNonSerializableProperties([() => {}])).toStrictEqual([]);
expect(removeNonSerializableProperties([(): void => {}])).toStrictEqual([]);
});
test('Array with single non serializable and serializable property', async () => {
expect(removeNonSerializableProperties([() => {}, 'dummy'])).toStrictEqual(['dummy']);
expect(removeNonSerializableProperties([(): void => {}, 'dummy'])).toStrictEqual(['dummy']);
});
test('Object with properties nested in object', async () => {
@ -56,7 +56,7 @@ test('Object with properties nested in array', async () => {
removeNonSerializableProperties({
parent: [
{
nonSerializable: () => {},
nonSerializable: (): void => {},
serializable: 'dummy',
},
],
@ -75,7 +75,7 @@ test('Object with single non serializable property nested in array', async () =>
removeNonSerializableProperties({
parent: [
{
nonSerializable: () => {},
nonSerializable: (): void => {},
serializable: 'dummy',
},
],

View file

@ -31,7 +31,7 @@ beforeAll(() => {
(window.events as unknown) = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};
@ -119,7 +119,7 @@ test('Expect executeCommand to be called with sanitize object', async () => {
render(ContributionActions, {
args: [
{
nonSerializable: () => {},
nonSerializable: (): void => {},
serializable: 'hello',
},
],
@ -143,7 +143,7 @@ test('Expect executeCommand to be called with sanitize object nested', async ()
args: [
{
parent: {
nonSerializable: () => {},
nonSerializable: (): void => {},
serializable: 'hello',
},
},

View file

@ -109,7 +109,7 @@ async function executeContribution(menu: Menu): Promise<void> {
{#each filteredContributions as menu}
<ListItemButtonIcon
title={menu.title}
onClick={() => executeContribution(menu)}
onClick={(): Promise<void> => executeContribution(menu)}
menu={dropdownMenu}
icon={getIcon(menu)}
detailed={detailed}

View file

@ -8,7 +8,7 @@ let imgSrc: string | undefined = undefined;
$: getImgSrc(image);
function getImgSrc(image: string | { light: string; dark: string } | undefined) {
function getImgSrc(image: string | { light: string; dark: string } | undefined): void {
new AppearanceUtil()
.getImage(image)
.then(s => (imgSrc = s))

View file

@ -44,7 +44,7 @@ export function onButtonClick(e: MouseEvent): void {
<DropdownMenu.Item
title="Manage authentication"
icon={faKey}
onClick={() => handleNavigation({ page: NavigationPage.AUTHENTICATION })} />
onClick={(): void => handleNavigation({ page: NavigationPage.AUTHENTICATION })} />
{#each $authenticationProviders as provider}
{@const sessionRequests = provider.sessionRequests ?? []}
@ -52,7 +52,7 @@ export function onButtonClick(e: MouseEvent): void {
{#each provider.accounts as account}
<DropdownMenu.Item
title="Sign out of {provider.displayName} ({account.label})"
onClick={() => window.requestAuthenticationProviderSignOut(provider.id, account.id)}
onClick={(): Promise<void> => window.requestAuthenticationProviderSignOut(provider.id, account.id)}
icon={faSignOut} />
{/each}
{/if}
@ -60,7 +60,7 @@ export function onButtonClick(e: MouseEvent): void {
{#each sessionRequests as request}
<DropdownMenu.Item
title="Sign in with {provider.displayName} to use {request.extensionLabel}"
onClick={() => window.requestAuthenticationProviderSignIn(request.id)}
onClick={(): Promise<void> => window.requestAuthenticationProviderSignIn(request.id)}
icon={faSignIn} />
{/each}
{/each}

View file

@ -58,7 +58,7 @@ function handleError(errorMessage: string): void {
onUpdate(compose);
}
async function startCompose() {
async function startCompose(): Promise<void> {
inProgress(true, 'STARTING');
try {
await window.startContainersByLabel(compose.engineId, composeLabel, compose.name);
@ -68,7 +68,7 @@ async function startCompose() {
inProgress(false);
}
}
async function stopCompose() {
async function stopCompose(): Promise<void> {
inProgress(true, 'STOPPING');
try {
await window.stopContainersByLabel(compose.engineId, composeLabel, compose.name);
@ -79,7 +79,7 @@ async function stopCompose() {
}
}
async function deleteCompose() {
async function deleteCompose(): Promise<void> {
inProgress(true, 'DELETING');
try {
await window.deleteContainersByLabel(compose.engineId, composeLabel, compose.name);
@ -90,7 +90,7 @@ async function deleteCompose() {
}
}
async function restartCompose() {
async function restartCompose(): Promise<void> {
inProgress(true, 'RESTARTING');
try {
await window.restartContainersByLabel(compose.engineId, composeLabel, compose.name);
@ -121,7 +121,7 @@ if (dropdownMenu) {
<ListItemButtonIcon
title="Start Compose"
onClick={() => startCompose()}
onClick={startCompose}
hidden={compose.status === 'RUNNING' || compose.status === 'STOPPING'}
detailed={detailed}
inProgress={compose.actionInProgress && compose.status === 'STARTING'}
@ -130,7 +130,7 @@ if (dropdownMenu) {
<ListItemButtonIcon
title="Stop Compose"
onClick={() => stopCompose()}
onClick={stopCompose}
hidden={!(compose.status === 'RUNNING' || compose.status === 'STOPPING')}
detailed={detailed}
inProgress={compose.actionInProgress && compose.status === 'STOPPING'}
@ -138,7 +138,7 @@ if (dropdownMenu) {
<ListItemButtonIcon
title="Delete Compose"
onClick={() => withConfirmation(deleteCompose, `delete compose ${compose.name}`)}
onClick={(): void => withConfirmation(deleteCompose, `delete compose ${compose.name}`)}
icon={faTrash}
detailed={detailed}
inProgress={compose.actionInProgress && compose.status === 'DELETING'} />
@ -148,21 +148,21 @@ if (dropdownMenu) {
{#if !detailed}
<ListItemButtonIcon
title="Generate Kube"
onClick={() => openGenerateKube()}
onClick={openGenerateKube}
menu={dropdownMenu}
detailed={detailed}
icon={faFileCode} />
{/if}
<ListItemButtonIcon
title="Deploy to Kubernetes"
onClick={() => deployToKubernetes()}
onClick={deployToKubernetes}
menu={dropdownMenu}
hidden={compose.engineType !== 'podman'}
detailed={detailed}
icon={faRocket} />
<ListItemButtonIcon
title="Restart Compose"
onClick={() => restartCompose()}
onClick={restartCompose}
menu={dropdownMenu}
detailed={detailed}
icon={faArrowsRotate} />

View file

@ -49,7 +49,7 @@ beforeAll(() => {
onDidUpdateProviderStatusMock.mockImplementation(() => Promise.resolve());
(window.events as unknown) = {
receive: (_channel: string, func: () => void) => {
receive: (_channel: string, func: () => void): void => {
func();
},
};

View file

@ -94,7 +94,7 @@ onDestroy(() => {
<div class="flex items-center w-5">
<div>&nbsp;</div>
</div>
<ComposeActions compose={compose} detailed={true} on:update={() => (compose = compose)} />
<ComposeActions compose={compose} detailed={true} on:update={(): ComposeInfoUI => (compose = compose)} />
</svelte:fragment>
<svelte:fragment slot="tabs">
<Tab title="Summary" selected={isTabSelected($router.path, 'summary')} url={getTabUrl($router.path, 'summary')} />

View file

@ -32,7 +32,7 @@ $: {
const colourizedContainerName = new Map<string, string>();
// Callback for logs which will output the logs to the terminal
function callback(name: string, data: string) {
function callback(name: string, data: string): void {
if (name === 'first-message') {
noLogs = false;
} else if (name === 'data') {
@ -61,7 +61,7 @@ async function fetchComposeLogs(): Promise<void> {
// in order to add padding to each output / make it look nice.
const promises = compose.containers.map(container => {
// Set a customer callback that will add the container name and padding
const logsCallback = (name: string, data: string) => {
const logsCallback = (name: string, data: string): void => {
const padding = ' '.repeat(maxNameLength - container.name.length);
const colouredName = colourizedContainerName.get(container.name);

View file

@ -11,7 +11,7 @@ import type { ComposeInfoUI } from './ComposeInfoUI';
export let compose: ComposeInfoUI;
function openContainer(containerID: string) {
function openContainer(containerID: string): void {
handleNavigation({
page: NavigationPage.CONTAINER_LOGS,
parameters: {
@ -48,7 +48,7 @@ function openContainer(containerID: string) {
{#each compose.containers as container}
<tr>
<DetailsCell>
<Link on:click={() => openContainer(container.id)}>{container.name}</Link>
<Link on:click={(): void => openContainer(container.id)}>{container.name}</Link>
</DetailsCell>
<DetailsCell>{container.id}</DetailsCell>
</tr>

View file

@ -44,7 +44,7 @@ onMount(() => {
});
});
async function loadDetails() {
async function loadDetails(): Promise<void> {
const getKubeConfigMap = await window.kubernetesReadNamespacedConfigMap(configMap.name, namespace);
if (getKubeConfigMap) {
kubeConfigMap = getKubeConfigMap;
@ -58,7 +58,7 @@ async function loadDetails() {
<DetailsPage title={configMap.name} subtitle={configMap.namespace} bind:this={detailsPage}>
<StatusIcon slot="icon" icon={ConfigMapIcon} size={24} status={configMap.status} />
<svelte:fragment slot="actions">
<ConfigMapSecretActions configMapSecret={configMap} detailed={true} on:update={() => (configMap = configMap)} />
<ConfigMapSecretActions configMapSecret={configMap} detailed={true} on:update={(): ConfigMapSecretUI => (configMap = configMap)} />
</svelte:fragment>
<div slot="detail" class="flex py-2 w-full justify-end text-sm text-[var(--pd-content-text)]">
<StateChange state={configMap.status} />

View file

@ -32,7 +32,7 @@ async function deleteConfigMapSecret(): Promise<void> {
<ListItemButtonIcon
title={`Delete ${configmapSecretUtils.isSecret(configMapSecret) ? 'Secret' : 'ConfigMap'}`}
onClick={() =>
onClick={(): void =>
withConfirmation(
deleteConfigMapSecret,
`delete ${configmapSecretUtils.isSecret(configMapSecret) ? 'secret' : 'configmap'} ${configMapSecret.name}`,

View file

@ -6,7 +6,7 @@ import type { ConfigMapSecretUI } from './ConfigMapSecretUI';
export let object: ConfigMapSecretUI;
function openDetails() {
function openDetails(): void {
const configmapSecretUtils = new ConfigMapSecretUtils();
if (configmapSecretUtils.isSecret(object)) {
router.goto(
@ -22,7 +22,7 @@ function openDetails() {
}
</script>
<button class="hover:cursor-pointer flex flex-col max-w-full" on:click={() => openDetails()}>
<button class="hover:cursor-pointer flex flex-col max-w-full" on:click={openDetails}>
<div class="text-sm text-[var(--pd-table-body-text-highlight)] max-w-full overflow-hidden text-ellipsis">
{object.name}
</div>

View file

@ -1,5 +1,5 @@
<script lang="ts">
import { faFileAlt, faKey } from '@fortawesome/free-solid-svg-icons';
import { faFileAlt, faKey, type IconDefinition } from '@fortawesome/free-solid-svg-icons';
import Fa from 'svelte-fa';
import Label from '../ui/Label.svelte';
@ -8,7 +8,7 @@ import type { ConfigMapSecretUI } from './ConfigMapSecretUI';
export let object: ConfigMapSecretUI;
// Determine the icon and color based on the type
function getTypeAttributes(type: string) {
function getTypeAttributes(type: string): { color: string; icon: IconDefinition } {
const isConfigMap = type === 'ConfigMap';
return {
color: 'text-[var(--pd-status-running)]',

View file

@ -29,6 +29,7 @@ import { get } from 'svelte/store';
import { beforeAll, beforeEach, expect, test, vi } from 'vitest';
import { kubernetesCurrentContextConfigMaps } from '/@/stores/kubernetes-contexts-state';
import type { ContextGeneralState } from '/@api/kubernetes-contexts-states';
import ConfigMapSecretList from './ConfigMapSecretList.svelte';
@ -41,9 +42,9 @@ beforeAll(() => {
beforeEach(() => {
vi.resetAllMocks();
vi.clearAllMocks();
(window as any).kubernetesGetContextsGeneralState = () => Promise.resolve(new Map());
(window as any).kubernetesGetCurrentContextGeneralState = () => Promise.resolve({});
(window as any).window.kubernetesUnregisterGetCurrentContextResources = () => Promise.resolve(undefined);
vi.mocked(window.kubernetesGetContextsGeneralState).mockResolvedValue(new Map());
vi.mocked(window.kubernetesGetCurrentContextGeneralState).mockResolvedValue({} as ContextGeneralState);
vi.mocked(window.kubernetesUnregisterGetCurrentContextResources).mockResolvedValue([]);
});
async function waitRender(customProperties: object): Promise<void> {

View file

@ -64,7 +64,7 @@ onDestroy(() => {
// delete the items selected in the list
let bulkDeleteInProgress = false;
async function deleteSelectedConfigMapsSecrets() {
async function deleteSelectedConfigMapsSecrets(): Promise<void> {
const selectedConfigMapsSecrets = configmapsSecretsUI.filter(configmapsSecretsUI => configmapsSecretsUI.selected);
if (selectedConfigMapsSecrets.length === 0) {
return;
@ -108,32 +108,32 @@ let statusColumn = new TableColumn<ConfigMapSecretUI>('Status', {
align: 'center',
width: '70px',
renderer: ConfigMapSecretColumnStatus,
comparator: (a, b) => a.status.localeCompare(b.status),
comparator: (a, b): number => a.status.localeCompare(b.status),
});
let nameColumn = new TableColumn<ConfigMapSecretUI>('Name', {
width: '1.3fr',
renderer: ConfigMapSecretColumnName,
comparator: (a, b) => a.name.localeCompare(b.name),
comparator: (a, b): number => a.name.localeCompare(b.name),
});
let ageColumn = new TableColumn<ConfigMapSecretUI, Date | undefined>('Age', {
renderMapping: configmapSecret => configmapSecret.created,
renderMapping: (configmapSecret): Date | undefined => configmapSecret.created,
renderer: TableDurationColumn,
comparator: (a, b) => moment(b.created).diff(moment(a.created)),
comparator: (a, b): number => moment(b.created).diff(moment(a.created)),
});
let keysColumn = new TableColumn<ConfigMapSecretUI, string>('Keys', {
renderMapping: config => config.keys.length.toString(),
renderMapping: (config): string => config.keys.length.toString(),
renderer: TableSimpleColumn,
comparator: (a, b) => a.keys.length - b.keys.length,
comparator: (a, b): number => a.keys.length - b.keys.length,
});
let typeColumn = new TableColumn<ConfigMapSecretUI>('Type', {
overflow: true,
width: '2fr',
renderer: ConfigMapSecretColumnType,
comparator: (a, b) => a.type.localeCompare(b.type),
comparator: (a, b): number => a.type.localeCompare(b.type),
});
const columns = [
@ -145,7 +145,7 @@ const columns = [
new TableColumn<ConfigMapSecretUI>('Actions', { align: 'right', renderer: ConfigMapSecretColumnActions }),
];
const row = new TableRow<ConfigMapSecretUI>({ selectable: _configmapSecret => true });
const row = new TableRow<ConfigMapSecretUI>({ selectable: (_configmapSecret): boolean => true });
</script>
<NavPage bind:searchTerm={searchTerm} title="configmaps & secrets">
@ -156,7 +156,7 @@ const row = new TableRow<ConfigMapSecretUI>({ selectable: _configmapSecret => tr
<svelte:fragment slot="bottom-additional-actions">
{#if selectedItemsNumber > 0}
<Button
on:click={() => deleteSelectedConfigMapsSecrets()}
on:click={deleteSelectedConfigMapsSecrets}
title="Delete {selectedItemsNumber} selected items"
inProgress={bulkDeleteInProgress}
icon={faTrash} />
@ -176,7 +176,7 @@ const row = new TableRow<ConfigMapSecretUI>({ selectable: _configmapSecret => tr
columns={columns}
row={row}
defaultSortColumn="Name"
on:update={() => (configmapsSecretsUI = configmapsSecretsUI)}>
on:update={(): ConfigMapSecretUI[] => (configmapsSecretsUI = configmapsSecretsUI)}>
</Table>
{#if $kubernetesCurrentContextConfigMapsFiltered.length === 0 && $kubernetesCurrentContextSecretsFiltered.length === 0}

View file

@ -46,7 +46,7 @@ onMount(() => {
});
});
async function loadDetails() {
async function loadDetails(): Promise<void> {
const getKubeSecret = await window.kubernetesReadNamespacedSecret(secret.name, namespace);
if (getKubeSecret) {
kubeSecret = getKubeSecret;
@ -60,7 +60,7 @@ async function loadDetails() {
<DetailsPage title={secret.name} subtitle={secret.namespace} bind:this={detailsPage}>
<StatusIcon slot="icon" icon={SecretIcon} size={24} status={secret.status} />
<svelte:fragment slot="actions">
<ConfigMapSecretActions configMapSecret={secret} detailed={true} on:update={() => (secret = secret)} />
<ConfigMapSecretActions configMapSecret={secret} detailed={true} on:update={(): ConfigMapSecretUI => (secret = secret)} />
</svelte:fragment>
<div slot="detail" class="flex py-2 w-full justify-end text-sm text-[var(--pd-content-text)]">
<StateChange state={secret.status} />

View file

@ -187,7 +187,7 @@ if (dropdownMenu) {
<ListItemButtonIcon
title="Start Container"
onClick={() => startContainer()}
onClick={startContainer}
hidden={container.state === 'RUNNING' || container.state === 'STOPPING'}
detailed={detailed}
inProgress={container.actionInProgress && container.state === 'STARTING'}
@ -196,7 +196,7 @@ if (dropdownMenu) {
<ListItemButtonIcon
title="Stop Container"
onClick={() => stopContainer()}
onClick={stopContainer}
hidden={!(container.state === 'RUNNING' || container.state === 'STOPPING')}
detailed={detailed}
inProgress={container.actionInProgress && container.state === 'STOPPING'}
@ -204,7 +204,7 @@ if (dropdownMenu) {
<ListItemButtonIcon
title="Delete Container"
onClick={() => withConfirmation(deleteContainer, `delete container ${container.name}`)}
onClick={(): void => withConfirmation(deleteContainer, `delete container ${container.name}`)}
icon={faTrash}
detailed={detailed}
inProgress={container.actionInProgress && container.state === 'DELETING'} />
@ -214,13 +214,13 @@ if (dropdownMenu) {
{#if !detailed}
<ListItemButtonIcon
title="Open Logs"
onClick={() => openLogs()}
onClick={openLogs}
menu={dropdownMenu}
detailed={false}
icon={faAlignLeft} />
<ListItemButtonIcon
title="Generate Kube"
onClick={() => openGenerateKube()}
onClick={openGenerateKube}
menu={dropdownMenu}
hidden={!(container.engineType === 'podman' && container.groupInfo.type === ContainerGroupInfoTypeUI.STANDALONE)}
detailed={detailed}
@ -228,14 +228,14 @@ if (dropdownMenu) {
{/if}
<ListItemButtonIcon
title="Deploy to Kubernetes"
onClick={() => deployToKubernetes()}
onClick={deployToKubernetes}
menu={dropdownMenu}
hidden={!(container.engineType === 'podman' && container.groupInfo.type === ContainerGroupInfoTypeUI.STANDALONE)}
detailed={detailed}
icon={faRocket} />
<ListItemButtonIcon
title="Open Browser"
onClick={() => openBrowser()}
onClick={openBrowser}
menu={dropdownMenu}
enabled={container.state === 'RUNNING' && container.hasPublicPort}
hidden={dropdownMenu && container.state !== 'RUNNING'}
@ -244,7 +244,7 @@ if (dropdownMenu) {
{#if !detailed}
<ListItemButtonIcon
title="Open Terminal"
onClick={() => openTerminalContainer()}
onClick={openTerminalContainer}
menu={dropdownMenu}
hidden={container.state !== 'RUNNING'}
detailed={false}
@ -252,14 +252,14 @@ if (dropdownMenu) {
{/if}
<ListItemButtonIcon
title="Restart Container"
onClick={() => restartContainer()}
onClick={restartContainer}
menu={dropdownMenu}
detailed={detailed}
icon={faArrowsRotate} />
<ListItemButtonIcon
title="Export Container"
tooltip="Exports container's filesystem contents as a tar archive and saves it on the local machine"
onClick={() => exportContainer()}
onClick={exportContainer}
menu={dropdownMenu}
detailed={detailed}
icon={faDownload} />

View file

@ -16,7 +16,7 @@ function openContainerDetails(container: ContainerInfoUI): void {
}
</script>
<button class="flex flex-col whitespace-nowrap max-w-full" on:click={() => openContainerDetails(object)}>
<button class="flex flex-col whitespace-nowrap max-w-full" on:click={(): void => openContainerDetails(object)}>
<div class="flex items-center max-w-full">
<div class="max-w-full">
<div class="flex flex-nowrap max-w-full">

View file

@ -29,7 +29,7 @@ function openGroupDetails(containerGroup: ContainerGroupInfoUI): void {
<button
class="flex flex-col text-[var(--pd-table-body-text-highlight)] max-w-full"
title={object.type}
on:click={() => openGroupDetails(object)}>
on:click={(): void => openGroupDetails(object)}>
<div class="max-w-full overflow-hidden text-ellipsis">
{object.name} ({object.type})
</div>

View file

@ -73,7 +73,7 @@ onMount(() => {
<svelte:fragment slot="subtitle">
<Link
aria-label="Image Details"
on:click={() => {
on:click={(): void => {
if (container.imageHref) {
router.goto(container.imageHref);
}
@ -87,7 +87,7 @@ onMount(() => {
<div>&nbsp;</div>
{/if}
</div>
<ContainerActions container={container} detailed={true} on:update={() => (container = container)} />
<ContainerActions container={container} detailed={true} on:update={(): ContainerInfoUI => (container = container)} />
</svelte:fragment>
<div slot="detail" class="flex py-2 w-full justify-end text-sm text-[var(--pd-content-text)]">
<StateChange state={container.state} />

View file

@ -33,7 +33,7 @@ let terminalParentDiv: HTMLDivElement;
let logsTerminal: Terminal;
function callback(name: string, data: string) {
function callback(name: string, data: string): void {
if (name === 'first-message') {
noLogs = false;
// clear on the first message
@ -51,7 +51,7 @@ function callback(name: string, data: string) {
}
}
async function fetchContainerLogs() {
async function fetchContainerLogs(): Promise<void> {
// grab logs of the container
await window.logsContainer({ engineId: container.engineId, containerId: container.id, callback });
}

View file

@ -41,7 +41,7 @@ if (container.groupInfo.created) {
<tr>
<DetailsCell>Image</DetailsCell>
<DetailsCell>
<Link on:click={() => router.goto(container.imageHref ?? $router.path)}>{container.image}</Link>
<Link on:click={(): void => router.goto(container.imageHref ?? $router.path)}>{container.image}</Link>
</DetailsCell>
</tr>
{#if container.command}
@ -72,7 +72,7 @@ if (container.groupInfo.created) {
</tr>
{#if Object.entries(container.labels).length > 0}
<tr>
<DetailsCell style="cursor-pointer flex items-center" onClick={() => (labelsDropdownOpen = !labelsDropdownOpen)}>
<DetailsCell style="cursor-pointer flex items-center" onClick={(): boolean => (labelsDropdownOpen = !labelsDropdownOpen)}>
Labels
<Fa class="ml-1" size="0.9x" icon={labelsDropdownOpen ? faChevronDown : faChevronRight} />
</DetailsCell>

View file

@ -37,7 +37,7 @@ $effect(() => {
lastState = container.state;
});
async function restartTerminal() {
async function restartTerminal(): Promise<void> {
await executeShellIntoContainer();
window.dispatchEvent(new Event('resize'));
}
@ -48,11 +48,11 @@ router.subscribe(route => {
});
// update terminal when receiving data
function receiveDataCallback(data: Buffer) {
function receiveDataCallback(data: Buffer): void {
shellTerminal.write(data.toString());
}
function receiveEndCallback() {
function receiveEndCallback(): void {
// need to reopen a new terminal if container is running
if (sendCallbackId && containerState === 'RUNNING') {
window
@ -68,7 +68,7 @@ function receiveEndCallback() {
}
// call exec command
async function executeShellIntoContainer() {
async function executeShellIntoContainer(): Promise<void> {
if (container.state !== 'RUNNING') {
return;
}
@ -92,7 +92,7 @@ async function executeShellIntoContainer() {
}
// refresh
async function refreshTerminal() {
async function refreshTerminal(): Promise<void> {
// missing element, return
if (!terminalXtermDiv) {
return;

View file

@ -20,7 +20,7 @@ $: listenTerminalData(attachContainerTerminal, callbackId);
// listenTerminalData only when attachContainerTerminal is bound from TerminalWindow component
// and callbackId is defined
function listenTerminalData(terminal: Terminal, cbId: number) {
function listenTerminalData(terminal: Terminal, cbId: number): void {
if (!attachContainerTerminal || !cbId) {
return;
}
@ -37,16 +37,16 @@ function listenTerminalData(terminal: Terminal, cbId: number) {
}
// update terminal when receiving data
function receiveDataCallback(data: Buffer) {
function receiveDataCallback(data: Buffer): void {
attachContainerTerminal?.write(data.toString());
}
function receiveEndCallback() {
function receiveEndCallback(): void {
closed = true;
}
// call exec command
async function attachToContainer() {
async function attachToContainer(): Promise<void> {
if (container.state !== 'RUNNING') {
return;
}

View file

@ -52,7 +52,7 @@ function getCommandLine(stoppedOnly: boolean): string {
return 'podman run quay.io/podman/hello';
}
}
async function runContainer(commandLine: string) {
async function runContainer(commandLine: string): Promise<void> {
try {
inProgress = true;
if (selectedProviderConnection) {
@ -84,7 +84,7 @@ async function runContainer(commandLine: string) {
title={title}
message={messageCommandLine}
commandline={commandLine}
on:click={() => window.clipboardWriteText(commandLine)}>
on:click={(): Promise<void> => window.clipboardWriteText(commandLine)}>
<div slot="upperContent" hidden={stoppedOnly}>
<span class="text-[var(--pd-details-empty-sub-header)] max-w-[800px] text-pretty mx-2">{messageButton}</span>
<div class="flex gap-2 justify-center p-3">
@ -92,7 +92,7 @@ async function runContainer(commandLine: string) {
title="Pull {helloImage} image and start container"
type="primary"
inProgress={inProgress}
on:click={() => runContainer(commandLine)}>Start your first container</Button>
on:click={(): Promise<void> => runContainer(commandLine)}>Start your first container</Button>
</div>
<h1 class="text-xl text-[var(--pd-details-empty-header)]">OR</h1>
</div>

View file

@ -40,7 +40,7 @@ onMount(() => {
});
});
async function selectFolderPath() {
async function selectFolderPath(): Promise<void> {
if (!container) return;
const result = await window.saveDialog({
@ -63,7 +63,7 @@ async function selectFolderPath() {
invalidFolder = false;
}
async function exportContainer() {
async function exportContainer(): Promise<void> {
if (!container) return;
exportedError = '';
@ -103,12 +103,12 @@ async function exportContainer() {
id="input-export-container-name"
aria-invalid={invalidFolder} />
<Button
on:click={() => selectFolderPath()}
on:click={selectFolderPath}
title="Open dialog to select the output file"
aria-label="Select output file">Browse ...</Button>
</div>
<Button
on:click={() => exportContainer()}
on:click={exportContainer}
class="w-full mt-5"
icon={faDownload}
inProgress={inProgress}

View file

@ -64,7 +64,7 @@ beforeAll(() => {
vi.mocked(window.getConfigurationValue).mockResolvedValue(false);
(window.events as unknown) = {
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -306,7 +306,7 @@ let statusColumn = new TableColumn<ContainerInfoUI | ContainerGroupInfoUI>('Stat
align: 'center',
width: '70px',
renderer: ContainerColumnStatus,
comparator: (a, b) => {
comparator: (a, b): number => {
const bStatus = ('status' in b ? b.status : 'state' in b ? b.state : '') ?? '';
const aStatus = ('status' in a ? a.status : 'state' in a ? a.state : '') ?? '';
return bStatus.localeCompare(aStatus);
@ -316,18 +316,18 @@ let statusColumn = new TableColumn<ContainerInfoUI | ContainerGroupInfoUI>('Stat
let nameColumn = new TableColumn<ContainerInfoUI | ContainerGroupInfoUI>('Name', {
width: '2fr',
renderer: ContainerColumnName,
comparator: (a, b) => a.name.localeCompare(b.name),
comparator: (a, b): number => a.name.localeCompare(b.name),
});
let envColumn = new TableColumn<ContainerInfoUI | ContainerGroupInfoUI>('Environment', {
renderer: ContainerColumnEnvironment,
comparator: (a, b) => (a.engineType ?? '').localeCompare(b.engineType ?? ''),
comparator: (a, b): number => (a.engineType ?? '').localeCompare(b.engineType ?? ''),
});
let imageColumn = new TableColumn<ContainerInfoUI | ContainerGroupInfoUI>('Image', {
width: '3fr',
renderer: ContainerColumnImage,
comparator: (a, b) => {
comparator: (a, b): number => {
const aImage = 'image' in a ? a.image : '';
const bImage = 'image' in b ? b.image : '';
return aImage.localeCompare(bImage);
@ -342,7 +342,7 @@ let ageColumn = new TableColumn<ContainerInfoUI | ContainerGroupInfoUI, Date | u
}
return undefined;
},
comparator: (a, b) => {
comparator: (a, b): number => {
const aTime = containerUtils.isContainerInfoUI(a) && a.state === 'RUNNING' ? (moment().diff(a.startedAt) ?? 0) : 0;
const bTime = containerUtils.isContainerInfoUI(b) && b.state === 'RUNNING' ? (moment().diff(b.startedAt) ?? 0) : 0;
return aTime - bTime;
@ -364,8 +364,8 @@ const columns = [
];
const row = new TableRow<ContainerGroupInfoUI | ContainerInfoUI>({
selectable: _container => true,
children: object => {
selectable: (_container): boolean => true,
children: (object): ContainerInfoUI[] => {
if ('type' in object && object.type !== ContainerGroupInfoTypeUI.STANDALONE) {
return object.containers;
} else {
@ -386,13 +386,13 @@ $: containersAndGroups = containerGroups.map(group =>
{#if $containersInfos.length > 0}
<Prune type="containers" engines={enginesList} />
{/if}
<Button on:click={() => toggleCreateContainer()} icon={faPlusCircle} title="Create a container">Create</Button>
<Button on:click={toggleCreateContainer} icon={faPlusCircle} title="Create a container">Create</Button>
</svelte:fragment>
<svelte:fragment slot="bottom-additional-actions">
{#if selectedItemsNumber > 0}
<div class="inline-flex space-x-2">
<Button
on:click={() =>
on:click={(): void =>
withBulkConfirmation(
deleteSelectedContainers,
`delete ${selectedItemsNumber} container${selectedItemsNumber > 1 ? 's' : ''}`,
@ -404,7 +404,7 @@ $: containersAndGroups = containerGroups.map(group =>
</Button>
<Button
on:click={() => createPodFromContainers()}
on:click={createPodFromContainers}
title="Create Pod with {selectedItemsNumber} selected items"
icon={SolidPodIcon}>
Create Pod
@ -415,11 +415,11 @@ $: containersAndGroups = containerGroups.map(group =>
</svelte:fragment>
<svelte:fragment slot="tabs">
<Button type="tab" on:click={() => resetRunningFilter()} selected={containerUtils.filterIsAll(searchTerm)}
<Button type="tab" on:click={resetRunningFilter} selected={containerUtils.filterIsAll(searchTerm)}
>All</Button>
<Button type="tab" on:click={() => setRunningFilter()} selected={containerUtils.filterIsRunning(searchTerm)}
<Button type="tab" on:click={setRunningFilter} selected={containerUtils.filterIsRunning(searchTerm)}
>Running</Button>
<Button type="tab" on:click={() => setStoppedFilter()} selected={containerUtils.filterIsStopped(searchTerm)}
<Button type="tab" on:click={setStoppedFilter} selected={containerUtils.filterIsStopped(searchTerm)}
>Stopped</Button>
</svelte:fragment>
@ -432,7 +432,7 @@ $: containersAndGroups = containerGroups.map(group =>
columns={columns}
row={row}
defaultSortColumn="Name"
on:update={() => (containerGroups = [...containerGroups])}>
on:update={(): ContainerGroupInfoUI[] => (containerGroups = [...containerGroups])}>
</Table>
{#if providerConnections.length === 0}
@ -442,7 +442,7 @@ $: containersAndGroups = containerGroups.map(group =>
<FilteredEmptyScreen
icon={ContainerIcon}
kind="containers"
on:resetFilter={e => {
on:resetFilter={(e): void => {
searchTerm = containerUtils.filterResetSearchTerm(searchTerm);
e.preventDefault();
}}
@ -459,7 +459,7 @@ $: containersAndGroups = containerGroups.map(group =>
{#if openChoiceModal}
<Dialog
title="Create a new container"
on:close={() => {
on:close={(): void => {
openChoiceModal = false;
}}>
<div slot="content" class="h-full flex flex-col justify-items-center text-[var(--pd-modal-text)]">
@ -470,8 +470,8 @@ $: containersAndGroups = containerGroups.map(group =>
</ul>
</div>
<svelte:fragment slot="buttons">
<Button type="primary" on:click={() => fromDockerfile()}>Containerfile or Dockerfile</Button>
<Button type="secondary" on:click={() => fromExistingImage()}>Existing image</Button>
<Button type="primary" on:click={fromDockerfile}>Containerfile or Dockerfile</Button>
<Button type="secondary" on:click={fromExistingImage}>Existing image</Button>
</svelte:fragment>
</Dialog>
{/if}

View file

@ -63,7 +63,7 @@ beforeAll(() => {
getContributedMenusMock.mockImplementation(() => Promise.resolve([]));
(window.events as unknown) = {
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -25,7 +25,7 @@ let firstIteration = true;
let cpuUsage: string;
let memoryUsage: string;
export async function updateStatistics(containerStats: ContainerStatsInfo) {
export async function updateStatistics(containerStats: ContainerStatsInfo): Promise<void> {
// we need enough data to compute the CPU usage
if (firstIteration) {
firstIteration = false;

View file

@ -33,7 +33,7 @@ import type { ContainerGroupInfoUI, ContainerGroupPartInfoUI, ContainerInfoUI }
import { ContainerGroupInfoTypeUI } from './ContainerInfoUI';
export class ContainerUtils {
getName(containerInfo: ContainerInfo) {
getName(containerInfo: ContainerInfo): string {
// If the container has no name, return an empty string.
if (containerInfo.Names.length === 0) {
return '';
@ -311,20 +311,20 @@ export class ContainerUtils {
context.setValue('containerImageName', container.Image);
}
filterResetRunning(f: string) {
filterResetRunning(f: string): string {
return f
.split(' ')
.filter(part => !part.startsWith('is:running') && !part.startsWith('is:stopped'))
.join(' ');
}
filterSetRunning(f: string) {
filterSetRunning(f: string): string {
const parts = f.split(' ').filter(part => !part.startsWith('is:running') && !part.startsWith('is:stopped'));
parts.push('is:running');
return parts.join(' ');
}
filterSetStopped(f: string) {
filterSetStopped(f: string): string {
const parts = f.split(' ').filter(part => !part.startsWith('is:running') && !part.startsWith('is:stopped'));
parts.push('is:stopped');
return parts.join(' ');

View file

@ -28,9 +28,9 @@ import { suite, test, vi } from 'vitest';
import { ContextKeyExpr, type ContextKeyExpression, implies, initContextKeysPlatform } from './contextKey.js';
function createContext(ctx: any) {
function createContext(ctx: any): { getValue: (key: string) => any } {
return {
getValue: (key: string) => {
getValue: (key: string): any => {
return ctx[key];
},
};

View file

@ -48,7 +48,7 @@ export async function initContextKeysPlatform(): Promise<void> {
}
/** allow register constant context keys that are known only after startup; requires running `substituteConstants` on the context key - https://github.com/microsoft/vscode/issues/174218#issuecomment-1437972127 */
export function setConstant(key: string, value: boolean) {
export function setConstant(key: string, value: boolean): void {
if (CONSTANT_VALUES.get(key) !== undefined) {
throw new Error('contextkey.setConstant(k, v) invoked with already set constant `k`');
}
@ -487,7 +487,7 @@ export class Parser {
offset: number;
lexeme: string;
},
) {
): number {
let parenBalance = 0;
switch (followingToken.type) {
case TokenType.LParen:
@ -610,11 +610,11 @@ export class Parser {
}
// careful: this can throw if current token is the initial one (ie index = 0)
private _previous() {
private _previous(): Token {
return this._tokens[this._current - 1];
}
private _matchOne(token: TokenType) {
private _matchOne(token: TokenType): boolean {
if (this._check(token)) {
this._advance();
return true;
@ -623,14 +623,14 @@ export class Parser {
return false;
}
private _advance() {
private _advance(): Token {
if (!this._isAtEnd()) {
this._current++;
}
return this._previous();
}
private _consume(type: TokenType, message: string) {
private _consume(type: TokenType, message: string): Token {
if (this._check(type)) {
return this._advance();
}
@ -638,7 +638,7 @@ export class Parser {
throw this._errExpectedButGot(message, this._peek());
}
private _errExpectedButGot(expected: string, got: Token, additionalInfo?: string) {
private _errExpectedButGot(expected: string, got: Token, additionalInfo?: string): Error {
const message = `Expected: ${expected}\nReceived: '${Scanner.getLexeme(got)}'.`;
const offset = got.offset;
const lexeme = Scanner.getLexeme(got);
@ -646,15 +646,15 @@ export class Parser {
return Parser._parseError;
}
private _check(type: TokenType) {
private _check(type: TokenType): boolean {
return this._peek().type === type;
}
private _peek() {
private _peek(): Token {
return this._tokens[this._current];
}
private _isAtEnd() {
private _isAtEnd(): boolean {
return this._peek().type === TokenType.EOF;
}
}
@ -2253,7 +2253,7 @@ function allElementsIncluded(p: ContextKeyExpression[], q: ContextKeyExpression[
return pIndex === p.length;
}
function getTerminals(node: ContextKeyExpression) {
function getTerminals(node: ContextKeyExpression): ContextKeyExpression[] {
if (node.type === ContextKeyExprType.Or) {
return node.expr;
}

View file

@ -28,7 +28,7 @@ import { test } from 'vitest';
import { Scanner, type Token, TokenType } from './scanner';
function tokenTypeToStr(token: Token) {
function tokenTypeToStr(token: Token): string {
switch (token.type) {
case TokenType.LParen:
return '(';
@ -75,7 +75,7 @@ function tokenTypeToStr(token: Token) {
}
}
function scan(input: string) {
function scan(input: string): { type: string; offset: number; lexeme?: string }[] {
return new Scanner()
.reset(input)
.scan()

View file

@ -99,7 +99,7 @@ export type LexingError = {
additionalInfo?: string;
};
function hintDidYouMean(...meant: string[]) {
function hintDidYouMean(...meant: string[]): string | undefined {
switch (meant.length) {
case 1:
return `Did you mean ${meant[0]}?`;
@ -199,7 +199,7 @@ export class Scanner {
return this._errors;
}
reset(value: string) {
reset(value: string): Scanner {
this._input = value;
this._start = 0;
@ -210,7 +210,7 @@ export class Scanner {
return this;
}
scan() {
scan(): Token[] {
while (!this._isAtEnd()) {
this._start = this._current;
@ -223,7 +223,7 @@ export class Scanner {
return Array.from(this._tokens);
}
scanAtPosition(ch: number) {
scanAtPosition(ch: number): void {
switch (ch) {
case CharCode.OpenParen:
this._addToken(TokenType.LParen);
@ -275,7 +275,7 @@ export class Scanner {
}
}
_scanExclamationMark() {
_scanExclamationMark(): void {
if (this._match(CharCode.Equals)) {
const isTripleEq = this._match(CharCode.Equals); // eat last `=` if `!==`
this._tokens.push({ type: TokenType.NotEq, offset: this._start, isTripleEq });
@ -284,7 +284,7 @@ export class Scanner {
}
}
_scanEquals() {
_scanEquals(): void {
if (this._match(CharCode.Equals)) {
// support `==`
const isTripleEq = this._match(CharCode.Equals); // eat last `=` if `===`
@ -296,7 +296,7 @@ export class Scanner {
}
}
_scanAmpersand() {
_scanAmpersand(): void {
if (this._match(CharCode.Ampersand)) {
this._addToken(TokenType.And);
} else {
@ -304,7 +304,7 @@ export class Scanner {
}
}
_scanPipe() {
_scanPipe(): void {
if (this._match(CharCode.Pipe)) {
this._addToken(TokenType.Or);
} else {
@ -331,11 +331,11 @@ export class Scanner {
return this._isAtEnd() ? CharCode.Null : this._input.charCodeAt(this._current);
}
private _addToken(type: TokenTypeWithoutLexeme) {
private _addToken(type: TokenTypeWithoutLexeme): void {
this._tokens.push({ type, offset: this._start });
}
private _error(additional?: string) {
private _error(additional?: string): void {
const offset = this._start;
const lexeme = this._input.substring(this._start, this._current);
const errToken: Token = { type: TokenType.Error, offset: this._start, lexeme };
@ -345,7 +345,7 @@ export class Scanner {
/* eslint-disable-next-line no-useless-escape, sonarjs/duplicates-in-character-class */
private stringRe = /[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy;
private _string() {
private _string(): void {
this.stringRe.lastIndex = this._start;
const match = this.stringRe.exec(this._input);
if (match) {
@ -361,7 +361,7 @@ export class Scanner {
}
// captures the lexeme without the leading and trailing '
private _quotedString() {
private _quotedString(): void {
while (this._peek() !== CharCode.SingleQuote && !this._isAtEnd()) {
this._advance();
}
@ -387,7 +387,7 @@ export class Scanner {
*
* Note that we want slashes within a regex to be escaped, e.g., /file:\\/\\/\\// should match `file:///`
*/
private _regex() {
private _regex(): void {
let p = this._current;
let inEscape = false;
@ -430,7 +430,7 @@ export class Scanner {
this._tokens.push({ type: TokenType.RegexStr, lexeme, offset: this._start });
}
private _isAtEnd() {
private _isAtEnd(): boolean {
return this._current >= this._input.length;
}
}

View file

@ -54,7 +54,7 @@ function hasNewProvider(oldProvidersId: string[], newProvidersId: string[]): boo
return false;
}
function onHide() {
function onHide(): void {
hasNewProviders = false;
hasNewNotifications = false;
}

View file

@ -8,7 +8,7 @@ import Markdown from '../markdown/Markdown.svelte';
export let notification: NotificationCard;
async function removeNotification(id: number) {
async function removeNotification(id: number): Promise<void> {
await window.removeNotification(id);
}
</script>
@ -38,7 +38,7 @@ async function removeNotification(id: number) {
</div>
{/if}
<div class="absolute top-2 right-2 text-[var(--pd-content-card-carousel-card-header-text)]">
<button on:click={() => removeNotification(notification.id)} aria-label={`Delete notification ${notification.id}`}>
<button on:click={(): Promise<void> => removeNotification(notification.id)} aria-label={`Delete notification ${notification.id}`}>
<Fa size="1x" icon={faXmark} />
</button>
</div>

View file

@ -38,7 +38,7 @@ async function openLink(url: string): Promise<void> {
{#if preCheck.docLinks}
See:
{#each preCheck.docLinks as link}
<Link aria-label="precheck-link" on:click={async () => await openLink(link.url)}>{link.title}</Link>
<Link aria-label="precheck-link" on:click={async (): Promise<void> => await openLink(link.url)}>{link.title}</Link>
{/each}
{/if}
{/if}

View file

@ -37,13 +37,13 @@ beforeAll(() => {
(window as any).startProvider = vi.fn();
// mock that autostart is configured as true
(window.getConfigurationValue as unknown) = (_key: string) => {
(window.getConfigurationValue as unknown) = (_key: string): boolean => {
return true;
};
// fake the window.events object
(window.events as unknown) = {
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -25,7 +25,7 @@ let runError: string | undefined = undefined;
let preflightChecks: CheckStatus[] = [];
async function runProvider() {
async function runProvider(): Promise<void> {
runError = undefined;
runInProgress = true;
try {
@ -62,7 +62,7 @@ onMount(async () => {
{/if} needs to be started.
</p>
<div class="w-1/3 flex justify-center">
<Button on:click={() => runProvider()}>
<Button on:click={runProvider}>
Run {provider.name}
</Button>
</div>
@ -89,7 +89,7 @@ onMount(async () => {
</svelte:fragment>
<svelte:fragment slot="update">
{#if provider.updateInfo?.version && provider.version !== provider.updateInfo?.version}
<ProviderUpdateButton onPreflightChecks={checks => (preflightChecks = checks)} provider={provider} />
<ProviderUpdateButton onPreflightChecks={(checks): CheckStatus[] => (preflightChecks = checks)} provider={provider} />
{/if}
</svelte:fragment>
</ProviderCard>

View file

@ -30,7 +30,7 @@ let logsTerminal;
let resizeObserver: ResizeObserver;
let termFit: FitAddon;
async function refreshTerminal() {
async function refreshTerminal(): Promise<void> {
// missing element, return
if (!logsXtermDiv) {
console.log('missing xterm div, exiting...');
@ -108,7 +108,7 @@ onDestroy(() => {
</svelte:fragment>
<svelte:fragment slot="update">
{#if provider.updateInfo?.version && provider.version !== provider.updateInfo?.version}
<ProviderUpdateButton onPreflightChecks={checks => (preflightChecks = checks)} provider={provider} />
<ProviderUpdateButton onPreflightChecks={(checks): CheckStatus[] => (preflightChecks = checks)} provider={provider} />
{/if}
</svelte:fragment>
</ProviderCard>

View file

@ -6,12 +6,12 @@ import { Button } from '@podman-desktop/ui-svelte';
import type { ProviderInfo } from '/@api/provider-info';
export let provider: ProviderInfo;
export let onDetectionChecks = (_detectionChecks: ProviderDetectionCheck[]) => {};
export let onDetectionChecks = (_detectionChecks: ProviderDetectionCheck[]): void => {};
let viewInProgress = false;
let mode: 'view' | 'hide' = 'view';
async function toggleDetectionChecks(provider: ProviderInfo) {
async function toggleDetectionChecks(provider: ProviderInfo): Promise<void> {
let detectionChecks: ProviderDetectionCheck[] = [];
if (mode === 'view') {
viewInProgress = true;
@ -33,7 +33,7 @@ async function toggleDetectionChecks(provider: ProviderInfo) {
{#if provider.detectionChecks.length > 0}
<Button
on:click={() => toggleDetectionChecks(provider)}
on:click={(): Promise<void> => toggleDetectionChecks(provider)}
inProgress={viewInProgress}
icon={faList}
title="Why {provider.name} is not found.">

View file

@ -14,7 +14,7 @@ let checksStatus: CheckStatus[] = [];
let preflightChecksFailed = false;
async function performInstallation(provider: ProviderInfo) {
async function performInstallation(provider: ProviderInfo): Promise<void> {
installInProgress = true;
checksStatus = [];
let checkSuccess = false;
@ -55,7 +55,7 @@ async function performInstallation(provider: ProviderInfo) {
inProgress={installInProgress}
disabled={preflightChecksFailed}
icon={faRocket}
on:click={() => performInstallation(provider)}>
on:click={(): Promise<void> => performInstallation(provider)}>
Install
</Button>
{/if}

View file

@ -66,7 +66,7 @@ beforeAll(() => {
(window as any).telemetryPage = vi.fn().mockResolvedValue(undefined);
(window as any).initializeProvider = vi.fn().mockResolvedValue([]);
(window.events as unknown) = {
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -45,13 +45,13 @@ let installationOptionSelected = InitializeAndStartMode;
$: initializationButtonVisible =
provider.containerProviderConnectionInitialization || provider.kubernetesProviderConnectionInitialization;
function showLastExecutionError() {
function showLastExecutionError(): void {
initializeError = initializationContext.error;
logsTerminal?.write('Initialization failed. Please check the error below and try again' + '\r\n');
logsTerminal?.write(initializeError + '\r');
}
async function initializeProvider() {
async function initializeProvider(): Promise<void> {
initializeError = undefined;
logsTerminal.clear();
initializeInProgress = true;
@ -65,7 +65,7 @@ async function initializeProvider() {
initializeInProgress = false;
}
async function refreshTerminal() {
async function refreshTerminal(): Promise<void> {
// missing element, return
if (!logsXtermDiv) {
console.log('missing xterm div, exiting...');
@ -120,11 +120,11 @@ onDestroy(() => {
resizeObserver?.unobserve(logsXtermDiv);
});
function updateOptionsMenu(visible: boolean) {
function updateOptionsMenu(visible: boolean): void {
installationOptionsMenuVisible = visible;
}
async function onInstallationClick() {
async function onInstallationClick(): Promise<void> {
initializeInProgress = true;
initializationButtonVisible = false;
initializationContext.mode = installationOptionSelected as InitializationMode;
@ -149,7 +149,7 @@ async function onInstallationClick() {
<button
class="inline-block bg-[var(--pd-button-primary-bg)] hover:bg-[var(--pd-button-primary-hover-bg)] text-[13px] text-[var(--pd-button-text)] pt-2 pr-3 pl-3 pb-2 w-[32px]"
aria-label="Installation options menu"
on:click={() => updateOptionsMenu(!installationOptionsMenuVisible)}>
on:click={(): void => updateOptionsMenu(!installationOptionsMenuVisible)}>
<i class="fas fa-caret-down"></i>
</button>
</div>
@ -160,7 +160,7 @@ async function onInstallationClick() {
<li>
<button
class="w-full p-2 bg-[var(--pd-button-primary-bg)] text-[var(--pd-button-text)] hover:bg-[var(--pd-button-primary-hover-bg)] cursor-pointer"
on:click={() => {
on:click={(): void => {
installationOptionSelected = InitializeOnlyMode;
installationOptionsMenuVisible = false;
}}>
@ -171,7 +171,7 @@ async function onInstallationClick() {
<li>
<button
class="w-full p-2 bg-[var(--pd-button-primary-bg)] text-[var(--pd-button-text)] hover:bg-[var(--pd-button-primary-hover-bg)] cursor-pointer"
on:click={() => {
on:click={(): void => {
installationOptionSelected = InitializeAndStartMode;
installationOptionsMenuVisible = false;
}}>
@ -206,7 +206,7 @@ async function onInstallationClick() {
</svelte:fragment>
<svelte:fragment slot="update">
{#if provider.updateInfo?.version && provider.version !== provider.updateInfo?.version}
<ProviderUpdateButton onPreflightChecks={checks => (preflightChecks = checks)} provider={provider} />
<ProviderUpdateButton onPreflightChecks={(checks): CheckStatus[] => (preflightChecks = checks)} provider={provider} />
{/if}
</svelte:fragment>
</ProviderCard>

View file

@ -10,7 +10,7 @@ export let provider: ProviderInfo;
<div class="mt-2 flex relative w-full content-stretch items-center flex-row justify-around flex-grow flex-nowrap">
{#each provider.links as link}
{#if link.group === undefined}
<Link class="text-base" on:click={() => window.openExternal(link.url)}>
<Link class="text-base" on:click={(): Promise<void> => window.openExternal(link.url)}>
{link.title}
</Link>
{/if}

View file

@ -22,8 +22,8 @@ let preflightChecks: CheckStatus[] = [];
Could not find an installation. To start working with containers, {provider.name} needs to be detected/installed.
</p>
<div class="flex space-x-2 w-full lg:w-1/3 justify-center">
<ProviderDetectionChecksButton onDetectionChecks={checks => (detectionChecks = checks)} provider={provider} />
<ProviderInstallationButton onPreflightChecks={checks => (preflightChecks = checks)} provider={provider} />
<ProviderDetectionChecksButton onDetectionChecks={(checks): ProviderDetectionCheck[] => (detectionChecks = checks)} provider={provider} />
<ProviderInstallationButton onPreflightChecks={(checks): CheckStatus[] => (preflightChecks = checks)} provider={provider} />
</div>
</div>
{#if detectionChecks.length > 0}

View file

@ -29,7 +29,7 @@ import { verifyStatus } from './ProviderStatusTestHelper.spec';
// fake the window.events object
beforeAll(() => {
(window.events as unknown) = {
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -27,7 +27,7 @@ let preflightChecks: CheckStatus[] = [];
</svelte:fragment>
<svelte:fragment slot="update">
{#if provider.updateInfo?.version && provider.version !== provider.updateInfo?.version}
<ProviderUpdateButton onPreflightChecks={checks => (preflightChecks = checks)} provider={provider} />
<ProviderUpdateButton onPreflightChecks={(checks): CheckStatus[] => (preflightChecks = checks)} provider={provider} />
{/if}
</svelte:fragment>
</ProviderCard>

View file

@ -13,7 +13,7 @@ let checksStatus: CheckStatus[] = [];
let preflightChecksFailed = false;
async function performUpdate(provider: ProviderInfo) {
async function performUpdate(provider: ProviderInfo): Promise<void> {
updateInProgress = true;
checksStatus = [];
@ -56,7 +56,7 @@ async function performUpdate(provider: ProviderInfo) {
disabled={preflightChecksFailed}
icon={faBoxOpen}
padding="px-3 py-0.5"
on:click={() => performUpdate(provider)}>
on:click={(): Promise<void> => performUpdate(provider)}>
Update to {provider.updateInfo.version}
</Button>
{/if}

View file

@ -19,23 +19,23 @@ const receiveShowReleaseNotes = window.events?.receive('show-release-notes', ()
showBanner = true;
});
async function openReleaseNotes() {
async function openReleaseNotes(): Promise<void> {
if (!notesURL) return;
await window.openExternal(notesURL);
}
async function updatePodmanDesktop() {
async function updatePodmanDesktop(): Promise<void> {
await window.updatePodmanDesktop();
}
async function getInfoFromNotes() {
async function getInfoFromNotes(): Promise<void> {
const releaseNotes = await window.podmanDesktopGetReleaseNotes();
notesInfo = releaseNotes.notes;
notesAvailable = notesInfo !== undefined;
notesURL = releaseNotes.notesURL;
}
async function onClose() {
async function onClose(): Promise<void> {
await window.updateConfigurationValue(`releaseNotesBanner.show`, currentVersion);
showBanner = false;
}

View file

@ -24,6 +24,6 @@ async function deleteDeployment(): Promise<void> {
<ListItemButtonIcon
title="Delete Deployment"
onClick={() => withConfirmation(deleteDeployment, `delete deployment ${deployment.name}`)}
onClick={(): void => withConfirmation(deleteDeployment, `delete deployment ${deployment.name}`)}
detailed={detailed}
icon={faTrash} />

View file

@ -22,9 +22,9 @@ import { render, screen } from '@testing-library/svelte';
import { expect, test } from 'vitest';
import DeploymentColumnConditions from './DeploymentColumnConditions.svelte';
import type { DeploymentCondition } from './DeploymentUI';
import type { DeploymentCondition, DeploymentUI } from './DeploymentUI';
function createDeploymentUI(conditions: DeploymentCondition[]) {
function createDeploymentUI(conditions: DeploymentCondition[]): DeploymentUI {
return {
uid: '123',
name: 'my-deployment',

View file

@ -17,7 +17,7 @@ import type { DeploymentCondition, DeploymentUI } from './DeploymentUI';
export let object: DeploymentUI;
// Determine both the icon and color based on the deployment condition
function getConditionAttributes(condition: DeploymentCondition) {
function getConditionAttributes(condition: DeploymentCondition): { name: string; color: string; icon: IconDefinition } {
const defaults = {
name: condition.type,
color: 'text-[var(--pd-status-unknown)]',

View file

@ -5,12 +5,12 @@ import type { DeploymentUI } from './DeploymentUI';
export let object: DeploymentUI;
function openDetails() {
function openDetails(): void {
router.goto(`/kubernetes/deployments/${encodeURI(object.name)}/${encodeURI(object.namespace)}/summary`);
}
</script>
<button class="hover:cursor-pointer flex flex-col max-w-full" on:click={() => openDetails()}>
<button class="hover:cursor-pointer flex flex-col max-w-full" on:click={openDetails}>
<div class="text-[var(--pd-table-body-text-highlight)] max-w-full overflow-hidden text-ellipsis">
{object.name}
</div>

View file

@ -50,7 +50,7 @@ onMount(() => {
});
});
async function loadDetails() {
async function loadDetails(): Promise<void> {
const getKubeDeployment = await window.kubernetesReadNamespacedDeployment(name, namespace);
if (getKubeDeployment) {
kubeDeployment = getKubeDeployment;
@ -64,7 +64,7 @@ async function loadDetails() {
<DetailsPage title={deployment.name} subtitle={deployment.namespace} bind:this={detailsPage}>
<StatusIcon slot="icon" icon={DeploymentIcon} size={24} status={deployment.status} />
<svelte:fragment slot="actions">
<DeploymentActions deployment={deployment} detailed={true} on:update={() => (deployment = deployment)} />
<DeploymentActions deployment={deployment} detailed={true} on:update={(): DeploymentUI => (deployment = deployment)} />
</svelte:fragment>
<svelte:fragment slot="tabs">
<Tab title="Summary" selected={isTabSelected($router.path, 'summary')} url={getTabUrl($router.path, 'summary')} />

View file

@ -29,6 +29,7 @@ import { get } from 'svelte/store';
import { beforeAll, beforeEach, expect, test, vi } from 'vitest';
import { kubernetesCurrentContextDeployments } from '/@/stores/kubernetes-contexts-state';
import type { ContextGeneralState } from '/@api/kubernetes-contexts-states';
import DeploymentsList from './DeploymentsList.svelte';
@ -41,13 +42,10 @@ beforeAll(() => {
beforeEach(() => {
vi.resetAllMocks();
vi.clearAllMocks();
(window as any).kubernetesGetContextsGeneralState = () => Promise.resolve(new Map());
(window as any).kubernetesGetCurrentContextGeneralState = () => Promise.resolve({});
(window as any).window.kubernetesUnregisterGetCurrentContextResources = () => Promise.resolve(undefined);
(window as any).getConfigurationValue = vi.fn();
vi.mocked(window.kubernetesGetContextsGeneralState).mockResolvedValue(new Map());
vi.mocked(window.kubernetesGetCurrentContextGeneralState).mockResolvedValue({} as ContextGeneralState);
vi.mocked(window.kubernetesUnregisterGetCurrentContextResources).mockResolvedValue([]);
vi.mocked(window.getConfigurationValue).mockResolvedValue(false);
(window as any).kubernetesDeleteDeployment = vi.fn();
vi.mocked(window.kubernetesDeleteDeployment);
});
async function waitRender(customProperties: object): Promise<void> {

View file

@ -45,7 +45,7 @@ onMount(() => {
// delete the items selected in the list
let bulkDeleteInProgress = false;
async function deleteSelectedDeployments() {
async function deleteSelectedDeployments(): Promise<void> {
const selectedDeployments = deployments.filter(deployment => deployment.selected);
if (selectedDeployments.length === 0) {
return;
@ -75,12 +75,12 @@ let statusColumn = new TableColumn<DeploymentUI>('Status', {
align: 'center',
width: '70px',
renderer: DeploymentColumnStatus,
comparator: (a, b) => a.status.localeCompare(b.status),
comparator: (a, b): number => a.status.localeCompare(b.status),
});
let nameColumn = new TableColumn<DeploymentUI>('Name', {
renderer: DeploymentColumnName,
comparator: (a, b) => a.name.localeCompare(b.name),
comparator: (a, b): number => a.name.localeCompare(b.name),
});
let conditionsColumn = new TableColumn<DeploymentUI>('Conditions', {
@ -94,9 +94,9 @@ let podsColumn = new TableColumn<DeploymentUI>('Pods', {
});
let ageColumn = new TableColumn<DeploymentUI, Date | undefined>('Age', {
renderMapping: deployment => deployment.created,
renderMapping: (deployment): Date | undefined => deployment.created,
renderer: TableDurationColumn,
comparator: (a, b) => moment(b.created).diff(moment(a.created)),
comparator: (a, b): number => moment(b.created).diff(moment(a.created)),
});
const columns = [
@ -108,7 +108,7 @@ const columns = [
new TableColumn<DeploymentUI>('Actions', { align: 'right', renderer: DeploymentColumnActions }),
];
const row = new TableRow<DeploymentUI>({ selectable: _deployment => true });
const row = new TableRow<DeploymentUI>({ selectable: (_deployment): boolean => true });
</script>
<NavPage bind:searchTerm={searchTerm} title="deployments">
@ -119,7 +119,7 @@ const row = new TableRow<DeploymentUI>({ selectable: _deployment => true });
<svelte:fragment slot="bottom-additional-actions">
{#if selectedItemsNumber > 0}
<Button
on:click={() =>
on:click={(): void =>
withBulkConfirmation(
deleteSelectedDeployments,
`delete ${selectedItemsNumber} deployment${selectedItemsNumber > 1 ? 's' : ''}`,
@ -143,7 +143,7 @@ const row = new TableRow<DeploymentUI>({ selectable: _deployment => true });
columns={columns}
row={row}
defaultSortColumn="Name"
on:update={() => (deployments = deployments)}>
on:update={(): DeploymentUI[] => (deployments = deployments)}>
</Table>
{#if $kubernetesCurrentContextDeploymentsFiltered.length === 0}
@ -152,7 +152,7 @@ const row = new TableRow<DeploymentUI>({ selectable: _deployment => true });
icon={DeploymentIcon}
kind="deployments"
searchTerm={searchTerm}
on:resetFilter={() => (searchTerm = '')} />
on:resetFilter={(): string => (searchTerm = '')} />
{:else}
<DeploymentEmptyScreen />
{/if}

View file

@ -48,7 +48,7 @@ onDestroy(() => {
let selectedFilteredIndex = 0;
let selectedIndex = 0;
async function handleKeydown(e: KeyboardEvent) {
async function handleKeydown(e: KeyboardEvent): Promise<void> {
// toggle display using F1 or ESC keys
if (e.key === 'F1') {
// clear the input value
@ -122,7 +122,7 @@ async function handleKeydown(e: KeyboardEvent) {
}
}
async function executeCommand(index: number) {
async function executeCommand(index: number): Promise<void> {
// get command id
const commandId = commandInfoItems[index].id;
// execute the command
@ -133,7 +133,7 @@ async function executeCommand(index: number) {
}
}
function handleMousedown(e: MouseEvent) {
function handleMousedown(e: MouseEvent): void {
if (!display) {
return;
}
@ -143,7 +143,7 @@ function handleMousedown(e: MouseEvent) {
}
}
async function clickOnItem(index: number) {
async function clickOnItem(index: number): Promise<void> {
// hide the command palette
display = false;
@ -152,7 +152,7 @@ async function clickOnItem(index: number) {
await executeCommand(selectedIndex);
}
async function onInputChange() {
async function onInputChange(): Promise<void> {
// in case of quick pick, filter the items
selectedFilteredIndex = 0;
@ -178,14 +178,14 @@ async function onInputChange() {
aria-label="Command palette command input"
type="text"
bind:value={inputValue}
on:input={() => onInputChange()}
on:input={onInputChange}
class="px-1 w-full text-[var(--pd-input-field-focused-text)] bg-[var(--pd-input-field-focused-bg)] border border-[var(--pd-input-field-stroke)] focus:outline-none" />
</div>
<ul class="max-h-[50vh] overflow-y-auto flex flex-col">
{#each filteredCommandInfoItems as item, i}
<li class="flex w-full flex-row" bind:this={scrollElements[i]} aria-label={item.id}>
<button
on:click={() => clickOnItem(i)}
on:click={(): Promise<void> => clickOnItem(i)}
class="text-[var(--pd-dropdown-item-text)] text-left relative my-0.5 mr-2 w-full {i === selectedFilteredIndex
? 'bg-[var(--pd-modal-dropdown-highlight)] selected'
: 'hover:bg-[var(--pd-dropdown-bg)]'} px-1">

View file

@ -30,7 +30,7 @@ onMount(() => {
window.events?.receive('showCustomPick:add', showCustomPickCallback);
});
function showCustomPickCallback(customQuickPickParameter: unknown) {
function showCustomPickCallback(customQuickPickParameter: unknown): void {
const options: CustomPickOptions | undefined = customQuickPickParameter as CustomPickOptions;
id = options?.id ?? 0;
title = options?.title ?? '';
@ -59,7 +59,7 @@ function handleSelection(
currentTarget: EventTarget & HTMLDivElement;
},
item: CustomPickItem,
) {
): void {
if (
e.target instanceof HTMLButtonElement &&
(e.target.ariaLabel === 'Less detail' || e.target.ariaLabel === 'Show more')
@ -77,12 +77,12 @@ function handleSelection(
items = items;
}
async function cancel() {
async function cancel(): Promise<void> {
await window.closeCustomPick(id);
display = false;
}
async function next() {
async function next(): Promise<void> {
const indexes = [];
for (let i = 0; i < items.length; i++) {
if (items[i].selected) {
@ -94,12 +94,12 @@ async function next() {
display = false;
}
function setSectionVisibility(index: number, show: boolean) {
function setSectionVisibility(index: number, show: boolean): void {
itemSectionHiddenStatus.set(index, show);
itemSectionHiddenStatus = itemSectionHiddenStatus;
}
function dragMe(node: HTMLElement) {
function dragMe(node: HTMLElement): void {
if (usePopperForDetails) {
let moving = false;
let left = 0;
@ -173,7 +173,7 @@ function dragMe(node: HTMLElement) {
class:group={!usePopperForDetails && !itemSectionHiddenStatus.get((i / colsPerRow) * colsPerRow + j)}
class:w-[300px]={colsPerRow === 2}
class:w-[250px]={colsPerRow === 3}
on:mousedown={e => handleSelection(e, innerItem)}>
on:mousedown={(e): void => handleSelection(e, innerItem)}>
{#if innerItem.selected}
<div class="relative">
<div class="absolute right-0 m-3 text-xl text-[var(--pd-invert-content-info-icon)]">
@ -209,7 +209,7 @@ function dragMe(node: HTMLElement) {
type="link"
aria-label="Show more"
icon={faAngleDown}
on:click={() => setSectionVisibility((i / colsPerRow) * colsPerRow + j, false)}>
on:click={(): void => setSectionVisibility((i / colsPerRow) * colsPerRow + j, false)}>
Show details
</Button>
</div>
@ -220,7 +220,7 @@ function dragMe(node: HTMLElement) {
role="button"
tabindex={0}
class:relative={usePopperForDetails}
on:mousedown={e => {
on:mousedown={(e): void => {
if (usePopperForDetails || itemSectionHiddenStatus.get((i / colsPerRow) * colsPerRow + j)) {
e.stopPropagation();
}
@ -240,7 +240,7 @@ function dragMe(node: HTMLElement) {
{#if usePopperForDetails}
<div class="relative">
<div class="absolute right-0 mr-2 text-xl">
<button on:click={() => setSectionVisibility((i / colsPerRow) * colsPerRow + j, true)}>
<button on:click={(): void => setSectionVisibility((i / colsPerRow) * colsPerRow + j, true)}>
<Fa size="0.9x" icon={faXmark} />
</button>
</div>
@ -280,7 +280,7 @@ function dragMe(node: HTMLElement) {
type="link"
aria-label="Less detail"
icon={faAngleUp}
on:click={() => setSectionVisibility((i / colsPerRow) * colsPerRow + j, true)}>
on:click={(): void => setSectionVisibility((i / colsPerRow) * colsPerRow + j, true)}>
Less details
</Button>
</div>
@ -296,8 +296,8 @@ function dragMe(node: HTMLElement) {
{/each}
<div class="px-5 py-5 mt-2 flex flex-row w-full justify-end space-x-5">
<Button type="link" aria-label="Cancel" on:click={() => cancel()}>Cancel</Button>
<Button aria-label="Next" disabled={!items.find(item => item.selected)} on:click={() => next()}>Ok</Button>
<Button type="link" aria-label="Cancel" on:click={cancel}>Cancel</Button>
<Button aria-label="Next" disabled={!items.find(item => item.selected)} on:click={next}>Ok</Button>
</div>
</div>
</div>

View file

@ -16,7 +16,7 @@ export let onclose: () => void = () => {
<slot name="icon" />
<h1 class="grow text-lg font-bold capitalize">{title}</h1>
<CloseButton on:click={() => onclose()} />
<CloseButton on:click={onclose} />
</div>
<div class="relative max-h-80 overflow-auto text-[var(--pd-modal-text)] px-10 py-4">

View file

@ -20,7 +20,7 @@ let buttonOrder: number[];
let display = false;
const showMessageBoxCallback = (messageBoxParameter: unknown) => {
const showMessageBoxCallback = (messageBoxParameter: unknown): void => {
const options: MessageBoxOptions | undefined = messageBoxParameter as MessageBoxOptions;
currentId = options?.id || 0;
title = options?.title || '';
@ -80,18 +80,18 @@ onDestroy(() => {
cleanup();
});
function cleanup() {
function cleanup(): void {
display = false;
title = '';
message = '';
}
async function clickButton(index?: number) {
async function clickButton(index?: number): Promise<void> {
await window.sendShowMessageBoxOnSelect(currentId, index);
cleanup();
}
async function onClose() {
async function onClose(): Promise<void> {
await window.sendShowMessageBoxOnSelect(currentId, cancelId >= 0 ? cancelId : undefined);
cleanup();
}
@ -134,9 +134,9 @@ function getButtonType(b: boolean): ButtonType {
<svelte:fragment slot="buttons">
{#each buttonOrder as i}
{#if i === cancelId}
<Button type="link" aria-label="Cancel" on:click={async () => await clickButton(i)}>Cancel</Button>
<Button type="link" aria-label="Cancel" on:click={async (): Promise<void> => await clickButton(i)}>Cancel</Button>
{:else}
<Button type={getButtonType(defaultId === i)} on:click={async () => await clickButton(i)}>{buttons[i]}</Button>
<Button type={getButtonType(defaultId === i)} on:click={async (): Promise<void> => await clickButton(i)}>{buttons[i]}</Button>
{/if}
{/each}
</svelte:fragment>

View file

@ -37,7 +37,7 @@ let quickPickCanPickMany = false;
let inputElement: HTMLInputElement | HTMLTextAreaElement | undefined = undefined;
let outerDiv: HTMLDivElement | undefined = undefined;
const showInputCallback = (inputCallpackParameter: unknown) => {
const showInputCallback = (inputCallpackParameter: unknown): void => {
const options: InputBoxOptions | undefined = inputCallpackParameter as InputBoxOptions;
mode = 'InputBox';
inputValue = options?.value;
@ -69,7 +69,7 @@ const showInputCallback = (inputCallpackParameter: unknown) => {
});
};
const showQuickPickCallback = (quickpickParameter: unknown) => {
const showQuickPickCallback = (quickpickParameter: unknown): void => {
const options: QuickPickOptions | undefined = quickpickParameter as QuickPickOptions;
mode = 'QuickPick';
placeHolder = options?.placeHolder;
@ -130,7 +130,7 @@ onMount(() => {
window.events?.receive('showQuickPick:add', showQuickPickCallback);
});
const onClose = async () => {
const onClose = async (): Promise<void> => {
if (validationError) {
return;
}
@ -143,7 +143,7 @@ const onClose = async () => {
};
// eslint-disable-next-line @typescript-eslint/no-explicit-any
async function onInputChange(event: any) {
async function onInputChange(event: any): Promise<void> {
// in case of quick pick, filter the items
if (mode === 'QuickPick') {
let val = event.target.value.toLowerCase();
@ -176,7 +176,7 @@ onDestroy(() => {
cleanup();
});
function cleanup() {
function cleanup(): void {
display = false;
inputValue = '';
placeHolder = '';
@ -189,7 +189,7 @@ function cleanup() {
ignoreFocusOut = false;
}
async function validateQuickPick() {
async function validateQuickPick(): Promise<void> {
if (mode === 'InputBox') {
// needs to convert the index from the filtered index to the original index
const originalIndex = quickPickItems.indexOf(quickPickFilteredItems[quickPickSelectedIndex]);
@ -212,7 +212,7 @@ async function validateQuickPick() {
cleanup();
}
async function clickQuickPickItem(item: QuickPickItem, index: number) {
async function clickQuickPickItem(item: QuickPickItem, index: number): Promise<void> {
if (quickPickCanPickMany) {
// reset index as we clicked
quickPickSelectedFilteredIndex = -1;
@ -226,7 +226,7 @@ async function clickQuickPickItem(item: QuickPickItem, index: number) {
}
}
async function handleKeydown(e: KeyboardEvent) {
async function handleKeydown(e: KeyboardEvent): Promise<void> {
if (!display) {
return;
}
@ -305,7 +305,7 @@ async function handleKeydown(e: KeyboardEvent) {
{#if multiline}
<textarea
bind:this={inputElement}
on:input={event => onInputChange(event)}
on:input={onInputChange}
bind:value={inputValue}
class="px-1 w-full h-20 text-[var(--pd-input-select-hover-text)] border {validationError
? 'border-[var(--pd-input-field-stroke-error)]'
@ -314,7 +314,7 @@ async function handleKeydown(e: KeyboardEvent) {
{:else}
<input
bind:this={inputElement}
on:input={event => onInputChange(event)}
on:input={onInputChange}
type="text"
bind:value={inputValue}
class="px-1 w-full text-[var(--pd-input-select-hover-text)] border {validationError
@ -350,7 +350,7 @@ async function handleKeydown(e: KeyboardEvent) {
{/if}
<button
title="Select {item.value}"
on:click={async () => await clickQuickPickItem(item, i)}
on:click={async (): Promise<void> => await clickQuickPickItem(item, i)}
class="text-[var(--pd-modal-dropdown-text)] text-left relative my-1 w-full px-1">
<div class="flex flex-col w-full">
<!-- first row is Value + optional description-->

View file

@ -7,7 +7,7 @@ export let title = '';
export let value: unknown;
// describes an arc with the given radius, centered at an x,y position matching the radius
function describeArc(radius: number, endAngle: number) {
function describeArc(radius: number, endAngle: number): string {
const angleInDegrees = endAngle >= 360 ? 359.9 : endAngle;
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;

View file

@ -20,7 +20,7 @@ export let readOnly = true;
const dispatch = createEventDispatcher<{ contentChange: string }>();
async function updateTheme(isDarkTheme: boolean) {
async function updateTheme(isDarkTheme: boolean): Promise<void> {
Monaco = await import('monaco-editor');
// check if we're in light or dark mode and get the terminal background color
const appearanceUtil = new AppearanceUtil();
@ -45,13 +45,13 @@ onMount(async () => {
});
self.MonacoEnvironment = {
getWorker: function (_moduleId: unknown, label: string) {
getWorker: function (_moduleId: unknown, label: string): Worker {
if (label === 'json') {
return new jsonWorker();
}
return new editorWorker();
},
createTrustedTypesPolicy: () => undefined,
createTrustedTypesPolicy: (): undefined | monaco.ITrustedTypePolicy => undefined,
};
Monaco = await import('monaco-editor');

View file

@ -34,6 +34,6 @@ export const ansi256Colours = [
// Function that takes the container name and ANSI colour and encapsulates the name in the colour,
// making sure that we reset the colour back to white after the name.
export function colourizedANSIContainerName(name: string, colour: string) {
export function colourizedANSIContainerName(name: string, colour: string): string {
return `${colour}${name}\u001b[0m`;
}

View file

@ -79,7 +79,7 @@ describe('images', () => {
const IMAGE_BUTTONS = [CANCEL_BUTTON, ALL_UNUSED_IMAGES, ALL_UNTAGGED_IMAGES];
const imageRender = () => {
const imageRender = (): void => {
render(Prune, {
type: 'images',
engines: [

View file

@ -95,4 +95,4 @@ async function prune(type: string, selectedItemLabel: string): Promise<void> {
}
</script>
<Button on:click={() => openPruneDialog()} title="Remove unused {type}" icon={faTrash}>Prune</Button>
<Button on:click={openPruneDialog} title="Remove unused {type}" icon={faTrash}>Prune</Button>

View file

@ -11,7 +11,7 @@ export let catalogExtensionUI: CatalogExtensionInfoUI;
export let oninstall: (extensionId: string) => void = () => {};
export let ondetails: (extensionId: string) => void = () => {};
function openExtensionDetails() {
function openExtensionDetails(): void {
ondetails(catalogExtensionUI.id);
router.goto(`/extensions/details/${catalogExtensionUI.id}/`);
}
@ -75,7 +75,7 @@ function openExtensionDetails() {
type="link"
icon={faArrowUpRightFromSquare}
aria-label="{catalogExtensionUI.displayName} details"
on:click={() => openExtensionDetails()}>More details</Button>
on:click={openExtensionDetails}>More details</Button>
</div>
</div>
</div>

View file

@ -11,7 +11,7 @@ export let showEmptyScreen: boolean = true;
export let oninstall: (extensionId: string) => void = () => {};
export let ondetails: (extensionId: string) => void = () => {};
async function fetchCatalog() {
async function fetchCatalog(): Promise<void> {
try {
await window.refreshCatalogExtensions();
} catch (error) {
@ -30,7 +30,7 @@ async function fetchCatalog() {
<div class="mb-4 flex flex-row">
<div class="flex items-center text-[var(--pd-content-header)]">{title}</div>
<div class="flex-1 text-right">
<Button type="link" on:click={() => fetchCatalog()}>Refresh the catalog</Button>
<Button type="link" on:click={fetchCatalog}>Refresh the catalog</Button>
</div>
</div>
{:else if showEmptyScreen}
@ -39,7 +39,7 @@ async function fetchCatalog() {
message="No extensions from the catalog. It seems that the internet connection was not available to download the catalog."
icon={faPuzzlePiece}>
<div class="flex gap-2 justify-center">
<Button type="link" on:click={() => fetchCatalog()}>Refresh the catalog</Button>
<Button type="link" on:click={fetchCatalog}>Refresh the catalog</Button>
</div>
</EmptyScreen>
{/if}

View file

@ -76,13 +76,13 @@ $: extension = derived(
{#if $extension.state === 'failed'}
<Button
type="tab"
on:click={() => {
on:click={(): void => {
screen = 'README';
}}
selected={screen === 'README'}>Readme</Button>
<Button
type="tab"
on:click={() => {
on:click={(): void => {
screen = 'ERROR';
}}
selected={screen === 'ERROR'}>Error</Button>

View file

@ -10,13 +10,13 @@ export let extension: CombinedExtensionInfoUI;
export let displayIcon: boolean = true;
function openDetailsExtension() {
function openDetailsExtension(): void {
router.goto(`/extensions/details/${encodeURIComponent(extension.id)}/`);
}
</script>
<Tooltip top tip="{extension.name} extension details">
<button aria-label="{extension.name} extension details" type="button" on:click={() => openDetailsExtension()}>
<button aria-label="{extension.name} extension details" type="button" on:click={openDetailsExtension}>
<div class="flex flex-row items-center text-[var(--pd-content-header)]">
{#if displayIcon}
<Fa icon={faArrowUpRightFromSquare} />

View file

@ -58,7 +58,7 @@ const filteredCatalogExtensions: Readable<CatalogExtensionInfoUI[]> = derived(
},
);
function closeModal() {
function closeModal(): void {
installManualImageModal = false;
}
@ -70,7 +70,7 @@ let installManualImageModal: boolean = false;
<NavPage bind:searchTerm={searchTerm} title="extensions">
<svelte:fragment slot="additional-actions">
<Button
on:click={() => {
on:click={(): void => {
installManualImageModal = true;
}}
icon={faCloudDownload}
@ -94,13 +94,13 @@ let installManualImageModal: boolean = false;
<svelte:fragment slot="tabs">
<Button
type="tab"
on:click={() => {
on:click={(): void => {
screen = 'installed';
}}
selected={screen === 'installed'}>Installed</Button>
<Button
type="tab"
on:click={() => {
on:click={(): void => {
screen = 'catalog';
}}
selected={screen === 'catalog'}>Catalog</Button>
@ -113,7 +113,7 @@ let installManualImageModal: boolean = false;
icon={ExtensionIcon}
kind="extensions"
searchTerm={searchTerm}
on:resetFilter={() => (searchTerm = '')} />
on:resetFilter={(): string => (searchTerm = '')} />
{/if}
<InstalledExtensionList extensionInfos={$filteredInstalledExtensions} />
{:else}
@ -122,7 +122,7 @@ let installManualImageModal: boolean = false;
icon={ExtensionIcon}
kind="extensions"
searchTerm={searchTerm}
on:resetFilter={() => (searchTerm = '')} />
on:resetFilter={(): string => (searchTerm = '')} />
{/if}
<CatalogExtensionList showEmptyScreen={!searchTerm} catalogExtensions={$filteredCatalogExtensions} />
{/if}
@ -131,7 +131,5 @@ let installManualImageModal: boolean = false;
{#if installManualImageModal}
<InstallManuallyExtensionModal
closeCallback={() => {
closeModal();
}} />
closeCallback={closeModal} />
{/if}

View file

@ -37,7 +37,7 @@ function validateImageName(event: Event): void {
inputfieldError = 'Invalid input';
}
async function installExtension() {
async function installExtension(): Promise<void> {
inputfieldError = undefined;
logs = [];
@ -76,7 +76,7 @@ async function installExtension() {
installInProgress = false;
}
async function handleKeydown(e: KeyboardEvent) {
async function handleKeydown(e: KeyboardEvent): Promise<void> {
if (e.key === 'Enter') {
e.preventDefault();
if (progressPercent === 100) {
@ -92,9 +92,7 @@ async function handleKeydown(e: KeyboardEvent) {
<Dialog
title="Install Custom Extension"
on:close={() => {
closeCallback();
}}>
on:close={closeCallback}>
<div slot="content" class="flex flex-col leading-5 space-y-5">
<div>
<label for="imageName" class="block pb-2 text-[var(--pd-modal-text)]">OCI Image:</label>
@ -105,7 +103,7 @@ async function handleKeydown(e: KeyboardEvent) {
name="imageName"
id="imageName"
placeholder="Enter OCI image name of the extension (e.g. quay.io/namespace/my-image)"
on:input={event => validateImageName(event)}
on:input={validateImageName}
disabled={installInProgress}
error={inputfieldError}
aria-invalid={inputfieldError !== ''}
@ -135,18 +133,16 @@ async function handleKeydown(e: KeyboardEvent) {
<svelte:fragment slot="buttons">
<Button
type="link"
on:click={() => {
closeCallback();
}}>Cancel</Button>
on:click={closeCallback}>Cancel</Button>
{#if installInProgress || progressPercent !== 100}
<Button
icon={faCloudDownload}
disabled={inputfieldError !== undefined}
on:click={() => installExtension()}
on:click={installExtension}
inProgress={installInProgress}>Install</Button>
{/if}
{#if !installInProgress && progressPercent === 100}
<Button on:click={() => closeCallback()}>Done</Button>
<Button on:click={closeCallback}>Done</Button>
{/if}
</svelte:fragment>
</Dialog>

View file

@ -22,7 +22,7 @@ async function deleteExtension(): Promise<void> {
<div class="text-sm">
<LoadingIconButton
clickAction={() => deleteExtension()}
clickAction={deleteExtension}
action="delete"
icon={faTrashCan}
state={{ status: extension.type === 'dd' ? 'stopped' : extension.removable ? extension.state : '', inProgress }}

View file

@ -18,7 +18,7 @@ async function startExtension(): Promise<void> {
{#if extension.state === 'stopped' || extension.state === 'failed'}
<LoadingIconButton
clickAction={() => startExtension()}
clickAction={startExtension}
action="start"
icon={faPlay}
state={{ status: extension.state, inProgress }}

View file

@ -18,7 +18,7 @@ async function stopExtension(): Promise<void> {
{#if extension.state === 'started' || extension.state === 'starting'}
<LoadingIconButton
clickAction={() => stopExtension()}
clickAction={stopExtension}
action="stop"
icon={faStop}
state={{ status: extension.type === 'dd' ? 'unsupported' : extension.state, inProgress }}

View file

@ -68,11 +68,11 @@ onDestroy(() => {
configurationPropertiesUnsubscribe?.();
});
function handleOnboarding() {
function handleOnboarding(): void {
router.goto(`/preferences/onboarding/${extension.id}`);
}
function handleProperties() {
function handleProperties(): void {
router.goto(`/preferences/default/preferences.${extension.id}`);
}
</script>
@ -83,7 +83,7 @@ function handleProperties() {
type="primary"
class="m-auto {!isOnboardingEnabled ? 'cursor-not-allowed' : ''}"
disabled={!isOnboardingEnabled}
on:click={() => handleOnboarding()}>
on:click={handleOnboarding}>
<Fa size="1x" icon={faGear} />
</Button>
@ -93,6 +93,6 @@ function handleProperties() {
type="secondary"
class="m-auto {!hasAnyConfiguration ? 'cursor-not-allowed' : ''}"
disabled={!hasAnyConfiguration}
on:click={() => handleProperties()}>
on:click={handleProperties}>
<Fa size="1x" icon={faFilePen} />
</Button>

View file

@ -60,7 +60,7 @@ const notFetchableFeaturedExtension: IFeaturedExtension = {
installed: false,
};
function assertPrimary(component: HTMLElement) {
function assertPrimary(component: HTMLElement): void {
expect(component).toBeDefined();
expect(component).toHaveClass('bg-[var(--pd-card-bg)]');
expect(component).toHaveClass('border-[var(--pd-card-bg)]');
@ -68,7 +68,7 @@ function assertPrimary(component: HTMLElement) {
expect(component).not.toHaveClass('border-[var(--pd-invert-content-card-bg)]');
}
function assertSecondary(component: HTMLElement) {
function assertSecondary(component: HTMLElement): void {
expect(component).toBeDefined();
expect(component).not.toHaveClass('bg-[var(--pd-card-bg)]');
expect(component).not.toHaveClass('border-[var(--pd-card-bg)]');

View file

@ -32,7 +32,7 @@ const extensionInstallFromImageMock = vi.fn();
beforeAll(() => {
(window as any).extensionInstallFromImage = extensionInstallFromImageMock;
(window.events as unknown) = {
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -20,7 +20,7 @@ let errorInstall = '';
let percentage = '0%';
async function installExtension() {
async function installExtension(): Promise<void> {
oninstall(extension.id);
errorInstall = '';
console.log('User asked to install the extension with the following properties', extension);
@ -72,7 +72,7 @@ async function installExtension() {
<button
aria-label="Install {extension.id} Extension"
on:click={() => installExtension()}
on:click={installExtension}
hidden={!extension.fetchable}
title="Install {extension.displayName} v{extension.fetchVersion} Extension"
class="border-2 relative rounded border-[var(--pd-button-secondary)] text-[var(--pd-button-secondary)] hover:text-[var(--pd-button-text)] hover:bg-[var(--pd-button-secondary-hover)] hover:border-[var(--pd-button-secondary-hover)] w-10 p-2 text-center cursor-pointer flex flex-row justify-center">

View file

@ -35,7 +35,7 @@ const getFeaturedExtensionsMock = vi.fn();
beforeAll(() => {
(window as any).getFeaturedExtensions = getFeaturedExtensionsMock;
(window.events as unknown) = {
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -37,7 +37,7 @@ vi.mock('./feedbackForms/DevelopersFeedback.svelte', () => ({
beforeAll(() => {
(window.events as unknown) = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};

View file

@ -30,7 +30,7 @@ let hasFeedback = $derived(
(contactInformation && contactInformation.trim().length > 4),
);
let { onCloseForm = () => {}, contentChange }: Props = $props();
let { onCloseForm = (): void => {}, contentChange }: Props = $props();
$effect(() => contentChange(Boolean(smileyRating || tellUsWhyFeedback || contactInformation)));
@ -70,7 +70,7 @@ async function openGitHub(): Promise<void> {
<label for="smiley" class="block mt-4 mb-2 text-sm font-medium text-[var(--pd-modal-text)]"
>How was your experience with Podman Desktop?</label>
<div class="flex space-x-4">
<button aria-label="very-sad-smiley" onclick={() => selectSmiley(1)}>
<button aria-label="very-sad-smiley" onclick={(): void => selectSmiley(1)}>
<Fa
size="1.5x"
class="cursor-pointer {smileyRating === 1
@ -78,7 +78,7 @@ async function openGitHub(): Promise<void> {
: 'text-[var(--pd-button-disabled-text)]'}"
icon={faFrown} />
</button>
<button aria-label="sad-smiley" onclick={() => selectSmiley(2)}>
<button aria-label="sad-smiley" onclick={(): void => selectSmiley(2)}>
<Fa
size="1.5x"
class="cursor-pointer {smileyRating === 2
@ -86,7 +86,7 @@ async function openGitHub(): Promise<void> {
: 'text-[var(--pd-button-disabled-text)]'}"
icon={faMeh} />
</button>
<button aria-label="happy-smiley" onclick={() => selectSmiley(3)}>
<button aria-label="happy-smiley" onclick={(): void => selectSmiley(3)}>
<Fa
size="1.5x"
class="cursor-pointer {smileyRating === 3
@ -94,7 +94,7 @@ async function openGitHub(): Promise<void> {
: 'text-[var(--pd-button-disabled-text)]'}"
icon={faSmile} />
</button>
<button aria-label="very-happy-smiley" onclick={() => selectSmiley(4)}>
<button aria-label="very-happy-smiley" onclick={(): void => selectSmiley(4)}>
<Fa
size="1.5x"
class="cursor-pointer {smileyRating === 4
@ -146,7 +146,7 @@ async function openGitHub(): Promise<void> {
{/if}
</svelte:fragment>
<svelte:fragment slot="buttons">
<Button disabled={smileyRating === 0 || (smileyRating === 1 && !hasFeedback)} on:click={() => sendFeedback()}
<Button disabled={smileyRating === 0 || (smileyRating === 1 && !hasFeedback)} on:click={sendFeedback}
>Send feedback</Button>
</svelte:fragment>
</FeedbackForm>

View file

@ -10,7 +10,7 @@ interface Props {
contentChange: (e: boolean) => void;
}
let { onCloseForm = () => {}, category = 'bug', contentChange }: Props = $props();
let { onCloseForm = (): void => {}, category = 'bug', contentChange }: Props = $props();
let issueTitle = $state('');
let issueDescription = $state('');
@ -113,7 +113,7 @@ async function previewOnGitHub(): Promise<void> {
{/if}
</svelte:fragment>
<svelte:fragment slot="buttons">
<Button class="underline" type="link" aria-label="Cancel" on:click={() => onCloseForm()}>Cancel</Button>
<Button class="underline" type="link" aria-label="Cancel" on:click={onCloseForm}>Cancel</Button>
<Button aria-label="Preview on GitHub" on:click={previewOnGitHub} disabled={!issueTitle || !issueDescription}>Preview on GitHub</Button>
</svelte:fragment>
</FeedbackForm>

View file

@ -41,7 +41,7 @@ suite('HelpActions component', () => {
vi.mocked(window.events.receive).mockImplementation((channel: string, callback: () => void) => {
toggleMenuCallback = callback;
return {
dispose: () => {},
dispose: (): void => {},
};
});
resizeObserverMock.mockReturnValue({ observe: vi.fn(), unobserve: vi.fn() });
@ -57,7 +57,7 @@ suite('HelpActions component', () => {
vi.mocked(window.events.receive).mockImplementation((channel: string, callback: () => void) => {
toggleMenuCallback = callback;
return {
dispose: () => {},
dispose: (): void => {},
};
});
const ha = render(HelpActions);
@ -104,7 +104,7 @@ suite('HelpActions component', () => {
vi.mocked(window.events.receive).mockImplementation((channel: string, callback: () => void) => {
toggleMenuCallback = callback;
return {
dispose: () => {},
dispose: (): void => {},
};
});
const ha = render(HelpActions);

View file

@ -47,7 +47,7 @@ async function onClick(action?: ItemAction): Promise<void> {
tooltip={item.tooltip}
icon={item.icon}
enabled={item.enabled}
onClick={() => onClick(item.action)}
onClick={(): Promise<void> => onClick(item.action)}
/>
{/each}
</HelpMenu>

View file

@ -7,7 +7,7 @@ let dropDownElement: HTMLElement;
const STATUS_BAR_HEIGHT = 24;
function updateMenuLocation() {
function updateMenuLocation(): void {
dropDownElement.style.top = `${window.innerHeight - dropDownHeight - STATUS_BAR_HEIGHT}px`;
dropDownElement.style.left = `${window.innerWidth - dropDownWidth - 1}px`;
}

View file

@ -5,7 +5,7 @@ import FlatMenu from '../ui/FlatMenu.svelte';
export let dropdownMenu = false;
export let dropdownMenuAsMenuActionItem = false;
export let onBeforeToggle = () => {};
export let onBeforeToggle = (): void => {};
</script>
{#if dropdownMenu}

View file

@ -44,7 +44,7 @@ vi.mock('@xterm/xterm', () => {
beforeAll(() => {
(window.events as unknown) = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
receive: (_channel: string, func: any) => {
receive: (_channel: string, func: any): void => {
func();
},
};
@ -78,7 +78,7 @@ async function waitRender(): Promise<void> {
}
// the build image page expects to have a valid provider connection, so let's mock one
function setup() {
function setup(): void {
const pStatus: ProviderStatus = 'started';
const pInfo: ProviderContainerConnectionInfo = {
name: 'test',

Some files were not shown because too many files have changed in this diff Show more